From b21c47b1c59d73280e6257d770ce299c67d5d9b4 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 11 Sep 2014 09:18:38 +0100 Subject: [PATCH 01/14] add @background arg to save used to flatten A out of images, if necessary vipsthumbnail rtd-img.png -o x.jpg[background=255] --- ChangeLog | 1 + libvips/conversion/embed.c | 9 ++++----- libvips/conversion/flatten.c | 17 ++++++++--------- libvips/foreign/foreign.c | 14 ++++++++++++-- libvips/include/vips/foreign.h | 7 ++++++- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index d937c726..92cf8fb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ - add vips_resize() - return of vips_init(), but just for bindings - revised type.c to make it more binding-friendly +- add @background arg to save: the colour to flatten against 8/9/14 started 7.40.9 - support jfif resunit "none" diff --git a/libvips/conversion/embed.c b/libvips/conversion/embed.c index 8a5e9a8b..ac5ad8a4 100644 --- a/libvips/conversion/embed.c +++ b/libvips/conversion/embed.c @@ -82,7 +82,7 @@ typedef struct _VipsEmbed { VipsImage *in; VipsExtend extend; - VipsArea *background; + VipsArrayDouble *background; int x; int y; int width; @@ -362,7 +362,8 @@ vips_embed_build( VipsObject *object ) if( !(embed->ink = vips__vector_to_ink( class->nickname, embed->in, - embed->background->data, NULL, embed->background->n )) ) + VIPS_AREA( embed->background )->data, NULL, + VIPS_AREA( embed->background )->n )) ) return( -1 ); if( !vips_object_argument_isset( object, "extend" ) && @@ -614,9 +615,7 @@ static void vips_embed_init( VipsEmbed *embed ) { embed->extend = VIPS_EXTEND_BLACK; - embed->background = - vips_area_new_array( G_TYPE_DOUBLE, sizeof( double ), 1 ); - ((double *) (embed->background->data))[0] = 0; + embed->background = vips_array_double_newv( 1, 0.0 ); } /** diff --git a/libvips/conversion/flatten.c b/libvips/conversion/flatten.c index f521f49c..df89a246 100644 --- a/libvips/conversion/flatten.c +++ b/libvips/conversion/flatten.c @@ -61,7 +61,7 @@ typedef struct _VipsFlatten { /* Background colour. */ - VipsArea *background; + VipsArrayDouble *background; /* The [double] converted to the input image format. */ @@ -319,8 +319,9 @@ vips_flatten_build( VipsObject *object ) /* Is the background black? We have a special path for this. */ black = TRUE; - for( i = 0; i < flatten->background->n; i++ ) - if( ((double *) flatten->background->data)[i] != 0.0 ) { + for( i = 0; i < VIPS_AREA( flatten->background )->n; i++ ) + if( vips_array_double_get( flatten->background, NULL )[i] != + 0.0 ) { black = FALSE; break; } @@ -336,8 +337,8 @@ vips_flatten_build( VipsObject *object ) */ if( !(flatten->ink = vips__vector_to_ink( class->nickname, conversion->out, - flatten->background->data, NULL, - flatten->background->n )) ) + VIPS_AREA( flatten->background )->data, NULL, + VIPS_AREA( flatten->background )->n )) ) return( -1 ); if( vips_image_generate( conversion->out, @@ -384,9 +385,7 @@ vips_flatten_class_init( VipsFlattenClass *class ) static void vips_flatten_init( VipsFlatten *flatten ) { - flatten->background = - vips_area_new_array( G_TYPE_DOUBLE, sizeof( double ), 1 ); - ((double *) (flatten->background->data))[0] = 0.0; + flatten->background = vips_array_double_newv( 1, 0.0 ); } /** @@ -397,7 +396,7 @@ vips_flatten_init( VipsFlatten *flatten ) * * Optional arguments: * - * @background: colour for new pixels + * @background: #VipsArrayDouble colour for new pixels * * Take the last band of @in as an alpha and use it to blend the * remaining channels with @background. diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index f838ea47..e0a80667 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -1146,7 +1146,9 @@ vips_foreign_convert_saveable( VipsForeignSave *save ) class->saveable == VIPS_SAVEABLE_RGB_CMYK) ) { VipsImage *out; - if( vips_flatten( in, &out, 0, NULL ) ) { + if( vips_flatten( in, &out, + "background", save->background, + NULL ) ) { g_object_unref( in ); return( -1 ); } @@ -1414,11 +1416,19 @@ vips_foreign_save_class_init( VipsForeignSaveClass *class ) VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSave, strip ), FALSE ); + + VIPS_ARG_BOXED( class, "background", 101, + _( "Background" ), + _( "Background value" ), + VIPS_ARGUMENT_OPTIONAL_INPUT, + G_STRUCT_OFFSET( VipsForeignSave, background ), + VIPS_TYPE_ARRAY_DOUBLE ); } static void -vips_foreign_save_init( VipsForeignSave *object ) +vips_foreign_save_init( VipsForeignSave *save ) { + save->background = vips_array_double_newv( 1, 0.0 ); } /* Can we write this filename with this file? diff --git a/libvips/include/vips/foreign.h b/libvips/include/vips/foreign.h index bc810423..ed096075 100644 --- a/libvips/include/vips/foreign.h +++ b/libvips/include/vips/foreign.h @@ -256,10 +256,15 @@ typedef enum { typedef struct _VipsForeignSave { VipsForeign parent_object; - /* Dont't attach metadata. + /* Don't attach metadata. */ gboolean strip; + /* If flattening out alpha, the background colour to use. Default to + * 0 (black). + */ + VipsArrayDouble *background; + /*< public >*/ /* The image we are to save, as supplied by our caller. From 4eeacd3c1f043da612335549aa22806d3746b634 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 11 Sep 2014 19:28:17 +0100 Subject: [PATCH 02/14] fix intro header list --- configure.ac | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index bd861ec9..4bc53358 100644 --- a/configure.ac +++ b/configure.ac @@ -103,26 +103,16 @@ headers="\ foreign.h \ interpolate.h \ header.h \ - type.h \ operation.h \ - buf.h \ - colour.h \ + enumtypes.h \ conversion.h \ - convolution.h \ - create.h \ - draw.h \ - freqfilt.h \ - histogram.h \ - memory.h \ - morphology.h \ - mosaicing.h \ arithmetic.h \ - rect.h \ - region.h \ - relational.h \ - resample.h" - -#headers="basic.h vips.h object.h image.h error.h foreign.h interpolate.h header.h operation.h enumtypes.h arithmetic.h conversion.h type.h" + colour.h \ + convolution.h \ + draw.h \ + morphology.h \ + type.h \ + region.h" for name in $headers; do vips_introspection_sources="$vips_introspection_sources include/vips/$name" From 62c73d5109f448240c6ac9f58c2f6ef955dfb0c8 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 11 Sep 2014 21:54:52 +0100 Subject: [PATCH 03/14] small bugs, start unit tests --- libvips.supp | 3 - python/atith.log | 1037 +++++++++++++++++++++++++++++++++++++ python/test_arithmetic.py | 41 ++ python/try5.py | 19 + python/vips8/vips.py | 4 +- 5 files changed, 1099 insertions(+), 5 deletions(-) create mode 100644 python/atith.log create mode 100755 python/test_arithmetic.py diff --git a/libvips.supp b/libvips.supp index 1e6c6ab1..aefca16d 100644 --- a/libvips.supp +++ b/libvips.supp @@ -380,6 +380,3 @@ fun:rb_enc_str_new } - - - diff --git a/python/atith.log b/python/atith.log new file mode 100644 index 00000000..7fadaf82 --- /dev/null +++ b/python/atith.log @@ -0,0 +1,1037 @@ +==19285== Memcheck, a memory error detector +==19285== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. +==19285== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info +==19285== Command: python test_arithmetic.py +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) +==19285== by 0x54B7B5: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== Address 0x5dfd020 is 1,056 bytes inside a block of size 2,731 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x585D8A: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x54B76E: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== Address 0x5e5b020 is 2,448 bytes inside a block of size 2,494 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x585D8A: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x54B76E: ??? (in /usr/bin/python2.7) +==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) +==19285== by 0x54B791: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== Address 0x5e45020 is 224 bytes inside a block of size 368 free'd +==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x4E5C58: PyList_Append (in /usr/bin/python2.7) +==19285== by 0x4A3DD3: ??? (in /usr/bin/python2.7) +==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) +==19285== by 0x4A409B: ??? (in /usr/bin/python2.7) +==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) +==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) +==19285== by 0x585CD5: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) +==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) +==19285== by 0x54B791: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== Address 0x5df0020 is 10,224 bytes inside a block of size 11,567 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x585D8A: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x54B87B: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== Address 0x5df3020 is 1,024 bytes inside a block of size 1,384 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x585CF8: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) +==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x54B86D: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== Address 0x5f60020 is 3,696 bytes inside a block of size 4,784 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x585CF8: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) +==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Conditional jump or move depends on uninitialised value(s) +==19285== at 0x540017: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x538954: PyGrammar_AddAccelerators (in /usr/bin/python2.7) +==19285== by 0x52B852: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Use of uninitialised value of size 8 +==19285== at 0x54002F: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x538954: PyGrammar_AddAccelerators (in /usr/bin/python2.7) +==19285== by 0x52B852: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x538954: PyGrammar_AddAccelerators (in /usr/bin/python2.7) +==19285== by 0x52B852: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== Address 0x5fad020 is 528 bytes inside a block of size 676 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x538954: PyGrammar_AddAccelerators (in /usr/bin/python2.7) +==19285== by 0x52B852: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) +==19285== by 0x47E0B0: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== Address 0x6033020 is 0 bytes after a block of size 768 free'd +==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x515136: ??? (in /usr/bin/python2.7) +==19285== by 0x4AFC90: ??? (in /usr/bin/python2.7) +==19285== by 0x477E66: ??? (in /usr/bin/python2.7) +==19285== by 0x477F7A: ??? (in /usr/bin/python2.7) +==19285== by 0x47C2C0: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== +==19285== Conditional jump or move depends on uninitialised value(s) +==19285== at 0x5BB279: ??? (in /usr/bin/python2.7) +==19285== by 0x537DEC: PyParser_AddToken (in /usr/bin/python2.7) +==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) +==19285== by 0x594759: PyParser_ASTFromFile (in /usr/bin/python2.7) +==19285== by 0x4699A6: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== +==19285== Use of uninitialised value of size 8 +==19285== at 0x5BB28E: ??? (in /usr/bin/python2.7) +==19285== by 0x537DEC: PyParser_AddToken (in /usr/bin/python2.7) +==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) +==19285== by 0x594759: PyParser_ASTFromFile (in /usr/bin/python2.7) +==19285== by 0x4699A6: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x5741E4: ??? (in /usr/bin/python2.7) +==19285== by 0x5743DA: ??? (in /usr/bin/python2.7) +==19285== by 0x5743DA: ??? (in /usr/bin/python2.7) +==19285== by 0x5AECFD: PyNode_Free (in /usr/bin/python2.7) +==19285== by 0x59478E: PyParser_ASTFromFile (in /usr/bin/python2.7) +==19285== by 0x4699A6: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== Address 0x60c3020 is 34,528 bytes inside a block of size 36,032 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x52B594: ??? (in /usr/bin/python2.7) +==19285== by 0x594759: PyParser_ASTFromFile (in /usr/bin/python2.7) +==19285== by 0x4699A6: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x4AECAE: ??? (in /usr/bin/python2.7) +==19285== by 0x4798D0: ??? (in /usr/bin/python2.7) +==19285== by 0x478A1B: ??? (in /usr/bin/python2.7) +==19285== by 0x47C2C0: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x46964C: ??? (in /usr/bin/python2.7) +==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== Address 0x60c8020 is 400 bytes inside a block of size 768 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x5392BC: ??? (in /usr/bin/python2.7) +==19285== by 0x4A991B: ??? (in /usr/bin/python2.7) +==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) +==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) +==19285== by 0x4C88F0: PySymtable_Build (in /usr/bin/python2.7) +==19285== by 0x47E032: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x46964C: ??? (in /usr/bin/python2.7) +==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x52738D: ??? (in /usr/bin/python2.7) +==19285== by 0x47B3EF: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3B6: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x46964C: ??? (in /usr/bin/python2.7) +==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== Address 0x60c8020 is 400 bytes inside a block of size 768 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x5392BC: ??? (in /usr/bin/python2.7) +==19285== by 0x4A991B: ??? (in /usr/bin/python2.7) +==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) +==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) +==19285== by 0x4C88F0: PySymtable_Build (in /usr/bin/python2.7) +==19285== by 0x47E032: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x46964C: ??? (in /usr/bin/python2.7) +==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) +==19285== by 0x47E0B0: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x46964C: ??? (in /usr/bin/python2.7) +==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== by 0x5076EC4: (below main) (libc-start.c:287) +==19285== Address 0x60cb020 is 0 bytes after a block of size 352 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x4EC49C: PyCode_Optimize (in /usr/bin/python2.7) +==19285== by 0x4A0126: ??? (in /usr/bin/python2.7) +==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x46964C: ??? (in /usr/bin/python2.7) +==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) +==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) +==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x472687: ??? (in /usr/bin/python2.7) +==19285== by 0x4733C9: ??? (in /usr/bin/python2.7) +==19285== by 0x530824: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x4CD49D: ??? (in /usr/bin/python2.7) +==19285== Address 0x6428020 is 1,488 bytes inside a block of size 1,559 free'd +==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x50C437: _PyString_Resize (in /usr/bin/python2.7) +==19285== by 0x472AA4: ??? (in /usr/bin/python2.7) +==19285== by 0x4733C9: ??? (in /usr/bin/python2.7) +==19285== by 0x530824: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x574286: ??? (in /usr/bin/python2.7) +==19285== by 0x52BC2B: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== Address 0x6435020 is 35,408 bytes inside a block of size 36,032 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x52B594: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) +==19285== by 0x47A16D: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== Address 0x643c020 is 16 bytes inside a block of size 32 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x4A0323: ??? (in /usr/bin/python2.7) +==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x4B0452: ??? (in /usr/bin/python2.7) +==19285== by 0x47A1A9: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== Address 0x643a020 is 384 bytes inside a block of size 768 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x5392BC: ??? (in /usr/bin/python2.7) +==19285== by 0x4A991B: ??? (in /usr/bin/python2.7) +==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) +==19285== by 0x4C88F0: PySymtable_Build (in /usr/bin/python2.7) +==19285== by 0x47E032: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x515136: ??? (in /usr/bin/python2.7) +==19285== by 0x4AFC43: ??? (in /usr/bin/python2.7) +==19285== by 0x47C2FB: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== Address 0x643c020 is 16 bytes inside a block of size 32 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x4A0323: ??? (in /usr/bin/python2.7) +==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) +==19285== by 0x5A5092: ??? (in /usr/bin/python2.7) +==19285== by 0x57929C: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== Address 0x643d020 is 688 bytes inside a block of size 1,536 free'd +==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x515136: ??? (in /usr/bin/python2.7) +==19285== by 0x4AFC43: ??? (in /usr/bin/python2.7) +==19285== by 0x47C2FB: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x53A541: ??? (in /usr/bin/python2.7) +==19285== by 0x55C5B8: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x4CD49D: ??? (in /usr/bin/python2.7) +==19285== by 0x55DBEB: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== Address 0x6428020 is 1,488 bytes inside a block of size 1,559 free'd +==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x50C437: _PyString_Resize (in /usr/bin/python2.7) +==19285== by 0x472AA4: ??? (in /usr/bin/python2.7) +==19285== by 0x4733C9: ??? (in /usr/bin/python2.7) +==19285== by 0x530824: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x50C437: _PyString_Resize (in /usr/bin/python2.7) +==19285== by 0x472AA4: ??? (in /usr/bin/python2.7) +==19285== by 0x4733C9: ??? (in /usr/bin/python2.7) +==19285== by 0x530824: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== Address 0x6496020 is 16 bytes after a block of size 48 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x46E3B6: ??? (in /usr/bin/python2.7) +==19285== by 0x52CCBB: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) +==19285== +==19285== Conditional jump or move depends on uninitialised value(s) +==19285== at 0x5BB279: ??? (in /usr/bin/python2.7) +==19285== by 0x5377E7: PyNode_AddChild (in /usr/bin/python2.7) +==19285== by 0x537E6E: PyParser_AddToken (in /usr/bin/python2.7) +==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== +==19285== Use of uninitialised value of size 8 +==19285== at 0x5BB28E: ??? (in /usr/bin/python2.7) +==19285== by 0x5377E7: PyNode_AddChild (in /usr/bin/python2.7) +==19285== by 0x537E6E: PyParser_AddToken (in /usr/bin/python2.7) +==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x54B87B: ??? (in /usr/bin/python2.7) +==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) +==19285== by 0x54B791: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== Address 0x5f3e020 is 0 bytes after a block of size 656 alloc'd +==19285== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x517A39: _PyObject_GC_NewVar (in /usr/bin/python2.7) +==19285== by 0x4F3142: PyFrame_New (in /usr/bin/python2.7) +==19285== by 0x52CE52: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) +==19285== by 0x54B791: ??? (in /usr/bin/python2.7) +==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) +==19285== by 0x54B791: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DD5A: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== Address 0x6461020 is 272 bytes inside a block of size 464 free'd +==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x4E5C58: PyList_Append (in /usr/bin/python2.7) +==19285== by 0x4A3DD3: ??? (in /usr/bin/python2.7) +==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) +==19285== by 0x4A409B: ??? (in /usr/bin/python2.7) +==19285== by 0x4A3F32: ??? (in /usr/bin/python2.7) +==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) +==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) +==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) +==19285== by 0x585CD5: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) +==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) +==19285== by 0x54B7B5: ??? (in /usr/bin/python2.7) +==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) +==19285== by 0x54B791: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DD5A: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== Address 0x6466020 is 2,016 bytes inside a block of size 2,152 free'd +==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x4E5C58: PyList_Append (in /usr/bin/python2.7) +==19285== by 0x4A3DD3: ??? (in /usr/bin/python2.7) +==19285== by 0x4A4104: ??? (in /usr/bin/python2.7) +==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) +==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) +==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) +==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) +==19285== by 0x585CD5: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) +==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x54B87B: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x46B0E6: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== Address 0x60d8020 is 32 bytes inside a block of size 200 free'd +==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x4E5C58: PyList_Append (in /usr/bin/python2.7) +==19285== by 0x4A3DD3: ??? (in /usr/bin/python2.7) +==19285== by 0x4A3F09: ??? (in /usr/bin/python2.7) +==19285== by 0x4A409B: ??? (in /usr/bin/python2.7) +==19285== by 0x585CD5: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) +==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== by 0x46B0E6: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x5AC787: _PyObject_GC_Resize (in /usr/bin/python2.7) +==19285== by 0x4F31AF: PyFrame_New (in /usr/bin/python2.7) +==19285== by 0x52CE52: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== Address 0x650d020 is 0 bytes inside a block of size 32 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x56EBAB: ??? (in /usr/bin/python2.7) +==19285== by 0x53A572: ??? (in /usr/bin/python2.7) +==19285== by 0x55C5B8: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Conditional jump or move depends on uninitialised value(s) +==19285== at 0x5BB279: ??? (in /usr/bin/python2.7) +==19285== by 0x537DEC: PyParser_AddToken (in /usr/bin/python2.7) +==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== +==19285== Use of uninitialised value of size 8 +==19285== at 0x5BB28E: ??? (in /usr/bin/python2.7) +==19285== by 0x537DEC: PyParser_AddToken (in /usr/bin/python2.7) +==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) +==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) +==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x4AF42F: ??? (in /usr/bin/python2.7) +==19285== by 0x4B0299: ??? (in /usr/bin/python2.7) +==19285== by 0x47A1A9: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== Address 0x82b7020 is 8 bytes after a block of size 152 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x477035: ??? (in /usr/bin/python2.7) +==19285== by 0x47761B: ??? (in /usr/bin/python2.7) +==19285== by 0x5791A7: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x47840F: ??? (in /usr/bin/python2.7) +==19285== by 0x47C2C0: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== Address 0x82b9020 is 752 bytes inside a block of size 768 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) +==19285== by 0x47A16D: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x54B87B: ??? (in /usr/bin/python2.7) +==19285== by 0x52C073: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) +==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) +==19285== Address 0x67ec020 is 0 bytes inside a block of size 64 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x5392FE: ??? (in /usr/bin/python2.7) +==19285== by 0x497381: ??? (in /usr/bin/python2.7) +==19285== by 0x539AAB: ??? (in /usr/bin/python2.7) +==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) +==19285== by 0x538F26: ??? (in /usr/bin/python2.7) +==19285== by 0x539AAB: ??? (in /usr/bin/python2.7) +==19285== by 0x5392FE: ??? (in /usr/bin/python2.7) +==19285== by 0x497381: ??? (in /usr/bin/python2.7) +==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) +==19285== by 0x538F26: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x515136: ??? (in /usr/bin/python2.7) +==19285== by 0x4AFC43: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== Address 0x833d020 is 0 bytes inside a block of size 32 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x539994: ??? (in /usr/bin/python2.7) +==19285== by 0x4A0323: ??? (in /usr/bin/python2.7) +==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x4AF42F: ??? (in /usr/bin/python2.7) +==19285== by 0x47986C: ??? (in /usr/bin/python2.7) +==19285== by 0x477FFE: ??? (in /usr/bin/python2.7) +==19285== by 0x47C2C0: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== Address 0x833f020 is 208 bytes inside a block of size 320 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x4EC48C: PyCode_Optimize (in /usr/bin/python2.7) +==19285== by 0x4A0126: ??? (in /usr/bin/python2.7) +==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) +==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) +==19285== by 0x579252: ??? (in /usr/bin/python2.7) +==19285== by 0x47C403: ??? (in /usr/bin/python2.7) +==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) +==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) +==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) +==19285== by 0x54B76E: ??? (in /usr/bin/python2.7) +==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) +==19285== by 0x46B0E6: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) +==19285== Address 0x83b5020 is 54,752 bytes inside a block of size 57,245 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x585D8A: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) +==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) +==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) +==19285== by 0x46B0E6: ??? (in /usr/bin/python2.7) +==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) +==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) +==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) +==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) +==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) +==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) +==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) +==19285== by 0x5390E0: ??? (in /usr/bin/python2.7) +==19285== by 0x52C94D: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x56D0A9: ??? (in /usr/bin/python2.7) +==19285== by 0x4D9853: ??? (in /usr/bin/python2.7) +==19285== by 0x4D8378: ??? (in /usr/bin/python2.7) +==19285== by 0x4F5D0A: ??? (in /usr/bin/python2.7) +==19285== by 0x52CC1F: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x56D0A9: ??? (in /usr/bin/python2.7) +==19285== Address 0x85f1020 is 0 bytes after a block of size 768 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x527BFF: ??? (in /usr/bin/python2.7) +==19285== by 0x4AD36B: _PyObject_GenericSetAttrWithDict (in /usr/bin/python2.7) +==19285== by 0x4CED55: ??? (in /usr/bin/python2.7) +==19285== by 0x4CF1B6: ??? (in /usr/bin/python2.7) +==19285== by 0x52C6D4: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x56D0A9: ??? (in /usr/bin/python2.7) +==19285== by 0x4D9853: ??? (in /usr/bin/python2.7) +==19285== by 0x4D8378: ??? (in /usr/bin/python2.7) +==19285== by 0x4F5D0A: ??? (in /usr/bin/python2.7) +==19285== +==19285== Invalid read of size 4 +==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) +==19285== by 0x5AC787: _PyObject_GC_Resize (in /usr/bin/python2.7) +==19285== by 0x4F31AF: PyFrame_New (in /usr/bin/python2.7) +==19285== by 0x56CE48: ??? (in /usr/bin/python2.7) +==19285== by 0x4D9853: ??? (in /usr/bin/python2.7) +==19285== by 0x54A327: PyObject_CallFunctionObjArgs (in /usr/bin/python2.7) +==19285== by 0x598B5A: ??? (in /usr/bin/python2.7) +==19285== by 0x4CE73C: ??? (in /usr/bin/python2.7) +==19285== by 0x4A1F81: ??? (in /usr/bin/python2.7) +==19285== by 0x52C6D4: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x56D0A9: ??? (in /usr/bin/python2.7) +==19285== by 0x4D9853: ??? (in /usr/bin/python2.7) +==19285== Address 0x111c9020 is 0 bytes after a block of size 16 free'd +==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) +==19285== by 0x6F3FCCA: g_slice_free_chain_with_offset (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0) +==19285== by 0x6C9E22B: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) +==19285== by 0x6C9DFD2: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) +==19285== by 0x6CA1BA4: g_object_set_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) +==19285== by 0x6CA2396: g_object_set (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) +==19285== by 0x892D4DD: vips_object_free_argument (object.c:937) +==19285== by 0x892CBBE: vips_argument_map (object.c:568) +==19285== by 0x892D50D: vips_argument_free_all (object.c:957) +==19285== by 0x892D572: vips_object_dispose (object.c:989) +==19285== by 0x8944330: vips_operation_dispose (operation.c:220) +==19285== by 0x8950870: vips_system_dispose (system.c:108) +==19285== +==19285== Invalid read of size 8 +==19285== at 0x683B580: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) +==19285== by 0x683A8CC: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) +==19285== by 0x683688B: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) +==19285== by 0x682C82D: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) +==19285== by 0x52CC1F: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== Address 0x0 is not stack'd, malloc'd or (recently) free'd +==19285== +==19285== +==19285== Process terminating with default action of signal 11 (SIGSEGV) +==19285== Access not within mapped region at address 0x0 +==19285== at 0x683B580: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) +==19285== by 0x683A8CC: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) +==19285== by 0x683688B: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) +==19285== by 0x682C82D: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) +==19285== by 0x52CC1F: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) +==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) +==19285== If you believe this happened as a result of a stack +==19285== overflow in your program's main thread (unlikely but +==19285== possible), you can try to increase the size of the +==19285== main thread stack using the --main-stacksize= flag. +==19285== The main thread stack size used in this run was 8388608. +==19285== +==19285== HEAP SUMMARY: +==19285== in use at exit: 9,373,405 bytes in 24,848 blocks +==19285== total heap usage: 105,481 allocs, 80,633 frees, 21,521,301 bytes allocated +==19285== +==19285== LEAK SUMMARY: +==19285== definitely lost: 0 bytes in 0 blocks +==19285== indirectly lost: 0 bytes in 0 blocks +==19285== possibly lost: 32,894 bytes in 58 blocks +==19285== still reachable: 3,243,770 bytes in 7,814 blocks +==19285== suppressed: 5,843,669 bytes in 15,154 blocks +==19285== Rerun with --leak-check=full to see details of leaked memory +==19285== +==19285== For counts of detected and suppressed errors, rerun with: -v +==19285== Use --track-origins=yes to see where uninitialised values come from +==19285== ERROR SUMMARY: 495 errors from 42 contexts (suppressed: 0 from 0) diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py new file mode 100755 index 00000000..e92180d8 --- /dev/null +++ b/python/test_arithmetic.py @@ -0,0 +1,41 @@ +#!/usr/bin/python + +import unittest + +#import logging +#logging.basicConfig(level = logging.DEBUG) + +from gi.repository import Vips +from vips8 import vips + +formats = [Vips.BandFormat.UCHAR, + Vips.BandFormat.CHAR, + Vips.BandFormat.USHORT, + Vips.BandFormat.SHORT, + Vips.BandFormat.UINT, + Vips.BandFormat.INT, + Vips.BandFormat.FLOAT, + Vips.BandFormat.DOUBLE, + Vips.BandFormat.COMPLEX, + Vips.BandFormat.DPCOMPLEX] + +class TestArithmetic(unittest.TestCase): + def setUp(self): + black = Vips.Image.black(100, 100) + mono = black.draw_circle(128, 50, 50, 50) + colour = Vips.Image.bandjoin([black, mono, black]) + images = [black, mono, colour] + + self.test_set = [x.cast(y) for x in images for y in formats] + self.avgs = [x.avg() for x in self.test_set] + + def test_addconst(self): + def add12(x): + return x + 12 + + self.assertEqual([add12(x).avg for x in self.test_set], + [add12(x) for x in self.avgs]) + +if __name__ == '__main__': + unittest.main() + diff --git a/python/try5.py b/python/try5.py index 0421160e..a17706cf 100755 --- a/python/try5.py +++ b/python/try5.py @@ -10,8 +10,27 @@ from vips8 import vips a = Vips.Image.new_from_file(sys.argv[1]) +def should_equal(test, a, b): + if abs(a - b) > 0.01: + print '%s: seen %g and %g' % (test, a, b) + sys.exit(1) + +def bandsplit(a): + return [a.extract_band(i) for i in range(0, a.bands)] + # test operator overloads + +# addition b = a + 12 +should_equal('add constant', a.avg() + 12, b.avg()) + +b = a + [12, 0, 0] +x = map (lambda x: x.avg()) bandsplit(a) +y = map (lambda x: x.avg()) bandsplit(b) +x[0] += 12 +should_equal('add multiband constant', sum(x), sum(y)) + + b = a + [12, 0, 0] b = a + b b = 12 + a diff --git a/python/vips8/vips.py b/python/vips8/vips.py index 945079c2..a080b572 100644 --- a/python/vips8/vips.py +++ b/python/vips8/vips.py @@ -323,7 +323,7 @@ def vips_rdiv(self, other): return (self ** -1) * other def vips_floor(self): - self.round(Vips.OperationRound.FLOOR) + return self.round(Vips.OperationRound.FLOOR) def vips_floordiv(self, other): if isinstance(other, Vips.Image): @@ -454,7 +454,7 @@ Vips.Image.__rmul__ = vips_mul Vips.Image.__div__ = vips_div Vips.Image.__rdiv__ = vips_rdiv Vips.Image.__floordiv__ = vips_floordiv -Vips.Image.__rfloordiv__ = vips_floordiv +Vips.Image.__rfloordiv__ = vips_rfloordiv Vips.Image.__mod__ = vips_mod Vips.Image.__pow__ = vips_pow Vips.Image.__rpow__ = vips_rpow From b1f3acf17b938ce863604652d48fd79907c28cac Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 12 Sep 2014 09:04:58 +0100 Subject: [PATCH 04/14] fix vipsthumbnail with input cmyk and output rgb profiles both specified ... it was importing twice, causing a band mismatch see https://github.com/jcupitt/libvips/issues/177 --- ChangeLog | 1 + tools/vipsthumbnail.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9f8fa9a..394f2ecb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - support jfif resunit "none" - support GRAY as an input and output ICC space - fix a read loop with setjmp() in png read, if the png file is broken +- fix vipsthumbnail with both input cmyk and output rgb profiles specified 8/9/14 started 7.40.8 - fix configure on rhel6 [Lovell] diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index a946bc0e..164cf598 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -397,6 +397,11 @@ thumbnail_shrink( VipsObject *process, VipsImage *in, VipsInterpretation interpretation = linear_processing ? VIPS_INTERPRETATION_XYZ : VIPS_INTERPRETATION_sRGB; + /* TRUE if we've done the import of an ICC transform and still need to + * export. + */ + gboolean have_imported; + int shrink; double residual; int tile_width; @@ -425,6 +430,7 @@ thumbnail_shrink( VipsObject *process, VipsImage *in, * an image in PCS which also has an attached profile, strange things * will happen. */ + have_imported = FALSE; if( (linear_processing || in->Type == VIPS_INTERPRETATION_CMYK) && in->Coding == VIPS_CODING_NONE && @@ -447,6 +453,8 @@ thumbnail_shrink( VipsObject *process, VipsImage *in, return( NULL ); in = t[1]; + + have_imported = TRUE; } /* To the processing colourspace. This will unpack LABQ as well. @@ -533,10 +541,11 @@ thumbnail_shrink( VipsObject *process, VipsImage *in, /* Colour management. * - * In linear mode, just export. In device space mode, do a combined + * If we've already imported, just export. Otherwise, we're in + * device space device and we need a combined * import/export to transform to the target space. */ - if( linear_processing ) { + if( have_imported ) { if( export_profile || vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) { vips_info( "vipsthumbnail", From e4461ae1f95df230db8fb5f50b0be456ef7bf078 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 12 Sep 2014 10:51:49 +0100 Subject: [PATCH 05/14] fix vipsthumbnail with broken embedded profiles if the embedded profile is broken or incompatible with the specified output profile, retry with the specified input profile see https://github.com/jcupitt/libvips/issues/178 --- ChangeLog | 2 ++ tools/vipsthumbnail.c | 52 +++++++++++++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 394f2ecb..ccef284f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ - support GRAY as an input and output ICC space - fix a read loop with setjmp() in png read, if the png file is broken - fix vipsthumbnail with both input cmyk and output rgb profiles specified +- vipsthumbnail retries with specified input profile if embedded profile is + broken 8/9/14 started 7.40.8 - fix configure on rhel6 [Lovell] diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index 164cf598..6ebb8e99 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -58,6 +58,9 @@ * - add an anti-alias filter between shrink and affine * - support CMYK * - use SEQ_UNBUF for a memory saving + * 12/9/14 + * - try with embedded profile first, if that fails retry with fallback + * profile */ #ifdef HAVE_CONFIG_H @@ -567,23 +570,48 @@ thumbnail_shrink( VipsObject *process, VipsImage *in, else if( export_profile && (vips_image_get_typeof( in, VIPS_META_ICC_NAME ) || import_profile) ) { - if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) - vips_info( "vipsthumbnail", - "importing with embedded profile" ); - else - vips_info( "vipsthumbnail", - "importing with profile %s", import_profile ); + VipsImage *out; vips_info( "vipsthumbnail", "exporting with profile %s", export_profile ); - if( vips_icc_transform( in, &t[7], export_profile, - "input_profile", import_profile, - "embedded", TRUE, - NULL ) ) - return( NULL ); + /* We first try with the embedded profile, if any, then if + * that fails try again with the supplied fallback profile. + */ + out = NULL; + if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) { + vips_info( "vipsthumbnail", + "importing with embedded profile" ); - in = t[7]; + if( vips_icc_transform( in, &t[7], export_profile, + "embedded", TRUE, + NULL ) ) { + vips_warn( "vipsthumbnail", + _( "unable to import with " + "embedded profile: %s" ), + vips_error_buffer() ); + + vips_error_clear(); + } + else + out = t[7]; + } + + if( !out && + import_profile ) { + vips_info( "vipsthumbnail", + "importing with fallback profile" ); + + if( vips_icc_transform( in, &t[7], export_profile, + "input_profile", import_profile, + "embedded", FALSE, + NULL ) ) + return( NULL ); + + out = t[7]; + } + + in = out; } /* If we are upsampling, don't sharpen, since nearest looks dumb From 666a0a6f83f73c031f75ab703cbd36f24d5627fc Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 12 Sep 2014 14:01:20 +0100 Subject: [PATCH 06/14] fix avg of complex oops, can't avg mod2, duh --- libvips/arithmetic/avg.c | 14 ++++---------- python/test_arithmetic.py | 2 +- python/vips8/vips.py | 2 ++ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libvips/arithmetic/avg.c b/libvips/arithmetic/avg.c index ca49214f..f2bdcf8b 100644 --- a/libvips/arithmetic/avg.c +++ b/libvips/arithmetic/avg.c @@ -32,6 +32,8 @@ * - remove liboil * 24/8/11 * - rewrite as a class + * 12/9/14 + * - oops, fix complex avg */ /* @@ -98,17 +100,11 @@ vips_avg_build( VipsObject *object ) if( VIPS_OBJECT_CLASS( vips_avg_parent_class )->build( object ) ) return( -1 ); - /* Calculate average. For complex, we accumulate re*re + - * im*im, so we need to sqrt. - */ vals = (gint64) vips_image_get_width( statistic->in ) * vips_image_get_height( statistic->in ) * vips_image_get_bands( statistic->in ); average = avg->sum / vals; - if( vips_band_format_iscomplex( - vips_image_get_format( statistic->in ) ) ) - average = sqrt( average ); g_object_set( object, "out", average, NULL ); return( 0 ); @@ -151,12 +147,10 @@ vips_avg_stop( VipsStatistic *statistic, void *seq ) TYPE *p = (TYPE *) in; \ \ for( i = 0; i < sz; i++ ) { \ - double mod; \ - \ - mod = p[0] * p[0] + p[1] * p[1]; \ - p += 2; \ + double mod = sqrt( p[0] * p[0] + p[1] * p[1] ); \ \ m += mod; \ + p += 2; \ } \ } diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index e92180d8..82acb2ce 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -33,7 +33,7 @@ class TestArithmetic(unittest.TestCase): def add12(x): return x + 12 - self.assertEqual([add12(x).avg for x in self.test_set], + self.assertEqual([add12(x).avg() for x in self.test_set], [add12(x) for x in self.avgs]) if __name__ == '__main__': diff --git a/python/vips8/vips.py b/python/vips8/vips.py index a080b572..c193a0f6 100644 --- a/python/vips8/vips.py +++ b/python/vips8/vips.py @@ -185,6 +185,8 @@ def _call_base(name, required, optional, self = None, option_string = None): if len(out) == 1: out = out[0] + elif len(out) == 0: + out = None # unref everything now we have refs to all outputs we want op2.unref_outputs() From 12304166ceb5ad63ebadfa657ccef1e72f2b8b57 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 13 Sep 2014 09:08:16 +0100 Subject: [PATCH 07/14] basic arith tests done small improvements to python binding --- python/atith.log | 1037 ------------------------------------- python/test_arithmetic.py | 115 +++- python/vips8/vips.py | 17 +- 3 files changed, 115 insertions(+), 1054 deletions(-) delete mode 100644 python/atith.log diff --git a/python/atith.log b/python/atith.log deleted file mode 100644 index 7fadaf82..00000000 --- a/python/atith.log +++ /dev/null @@ -1,1037 +0,0 @@ -==19285== Memcheck, a memory error detector -==19285== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. -==19285== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info -==19285== Command: python test_arithmetic.py -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) -==19285== by 0x54B7B5: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== Address 0x5dfd020 is 1,056 bytes inside a block of size 2,731 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x585D8A: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x54B76E: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== Address 0x5e5b020 is 2,448 bytes inside a block of size 2,494 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x585D8A: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x54B76E: ??? (in /usr/bin/python2.7) -==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) -==19285== by 0x54B791: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== Address 0x5e45020 is 224 bytes inside a block of size 368 free'd -==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x4E5C58: PyList_Append (in /usr/bin/python2.7) -==19285== by 0x4A3DD3: ??? (in /usr/bin/python2.7) -==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) -==19285== by 0x4A409B: ??? (in /usr/bin/python2.7) -==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) -==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) -==19285== by 0x585CD5: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) -==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) -==19285== by 0x54B791: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== Address 0x5df0020 is 10,224 bytes inside a block of size 11,567 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x585D8A: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x54B87B: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== Address 0x5df3020 is 1,024 bytes inside a block of size 1,384 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x585CF8: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) -==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x54B86D: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== Address 0x5f60020 is 3,696 bytes inside a block of size 4,784 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x585CF8: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) -==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Conditional jump or move depends on uninitialised value(s) -==19285== at 0x540017: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x538954: PyGrammar_AddAccelerators (in /usr/bin/python2.7) -==19285== by 0x52B852: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Use of uninitialised value of size 8 -==19285== at 0x54002F: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x538954: PyGrammar_AddAccelerators (in /usr/bin/python2.7) -==19285== by 0x52B852: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x538954: PyGrammar_AddAccelerators (in /usr/bin/python2.7) -==19285== by 0x52B852: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== Address 0x5fad020 is 528 bytes inside a block of size 676 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x538954: PyGrammar_AddAccelerators (in /usr/bin/python2.7) -==19285== by 0x52B852: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) -==19285== by 0x47E0B0: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== Address 0x6033020 is 0 bytes after a block of size 768 free'd -==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x515136: ??? (in /usr/bin/python2.7) -==19285== by 0x4AFC90: ??? (in /usr/bin/python2.7) -==19285== by 0x477E66: ??? (in /usr/bin/python2.7) -==19285== by 0x477F7A: ??? (in /usr/bin/python2.7) -==19285== by 0x47C2C0: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== -==19285== Conditional jump or move depends on uninitialised value(s) -==19285== at 0x5BB279: ??? (in /usr/bin/python2.7) -==19285== by 0x537DEC: PyParser_AddToken (in /usr/bin/python2.7) -==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) -==19285== by 0x594759: PyParser_ASTFromFile (in /usr/bin/python2.7) -==19285== by 0x4699A6: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== -==19285== Use of uninitialised value of size 8 -==19285== at 0x5BB28E: ??? (in /usr/bin/python2.7) -==19285== by 0x537DEC: PyParser_AddToken (in /usr/bin/python2.7) -==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) -==19285== by 0x594759: PyParser_ASTFromFile (in /usr/bin/python2.7) -==19285== by 0x4699A6: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x5741E4: ??? (in /usr/bin/python2.7) -==19285== by 0x5743DA: ??? (in /usr/bin/python2.7) -==19285== by 0x5743DA: ??? (in /usr/bin/python2.7) -==19285== by 0x5AECFD: PyNode_Free (in /usr/bin/python2.7) -==19285== by 0x59478E: PyParser_ASTFromFile (in /usr/bin/python2.7) -==19285== by 0x4699A6: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== Address 0x60c3020 is 34,528 bytes inside a block of size 36,032 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x52B594: ??? (in /usr/bin/python2.7) -==19285== by 0x594759: PyParser_ASTFromFile (in /usr/bin/python2.7) -==19285== by 0x4699A6: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x4AECAE: ??? (in /usr/bin/python2.7) -==19285== by 0x4798D0: ??? (in /usr/bin/python2.7) -==19285== by 0x478A1B: ??? (in /usr/bin/python2.7) -==19285== by 0x47C2C0: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x46964C: ??? (in /usr/bin/python2.7) -==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== Address 0x60c8020 is 400 bytes inside a block of size 768 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x5392BC: ??? (in /usr/bin/python2.7) -==19285== by 0x4A991B: ??? (in /usr/bin/python2.7) -==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) -==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) -==19285== by 0x4C88F0: PySymtable_Build (in /usr/bin/python2.7) -==19285== by 0x47E032: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x46964C: ??? (in /usr/bin/python2.7) -==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x52738D: ??? (in /usr/bin/python2.7) -==19285== by 0x47B3EF: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3B6: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x46964C: ??? (in /usr/bin/python2.7) -==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== Address 0x60c8020 is 400 bytes inside a block of size 768 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x5392BC: ??? (in /usr/bin/python2.7) -==19285== by 0x4A991B: ??? (in /usr/bin/python2.7) -==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) -==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) -==19285== by 0x4C88F0: PySymtable_Build (in /usr/bin/python2.7) -==19285== by 0x47E032: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x46964C: ??? (in /usr/bin/python2.7) -==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) -==19285== by 0x47E0B0: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x46964C: ??? (in /usr/bin/python2.7) -==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== by 0x5076EC4: (below main) (libc-start.c:287) -==19285== Address 0x60cb020 is 0 bytes after a block of size 352 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x4EC49C: PyCode_Optimize (in /usr/bin/python2.7) -==19285== by 0x4A0126: ??? (in /usr/bin/python2.7) -==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x46964C: ??? (in /usr/bin/python2.7) -==19285== by 0x4699E2: PyRun_FileExFlags (in /usr/bin/python2.7) -==19285== by 0x469F1B: PyRun_SimpleFileExFlags (in /usr/bin/python2.7) -==19285== by 0x46AB80: Py_Main (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x472687: ??? (in /usr/bin/python2.7) -==19285== by 0x4733C9: ??? (in /usr/bin/python2.7) -==19285== by 0x530824: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x4CD49D: ??? (in /usr/bin/python2.7) -==19285== Address 0x6428020 is 1,488 bytes inside a block of size 1,559 free'd -==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x50C437: _PyString_Resize (in /usr/bin/python2.7) -==19285== by 0x472AA4: ??? (in /usr/bin/python2.7) -==19285== by 0x4733C9: ??? (in /usr/bin/python2.7) -==19285== by 0x530824: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x574286: ??? (in /usr/bin/python2.7) -==19285== by 0x52BC2B: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== Address 0x6435020 is 35,408 bytes inside a block of size 36,032 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x52B594: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) -==19285== by 0x47A16D: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== Address 0x643c020 is 16 bytes inside a block of size 32 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x4A0323: ??? (in /usr/bin/python2.7) -==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x4B0452: ??? (in /usr/bin/python2.7) -==19285== by 0x47A1A9: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== Address 0x643a020 is 384 bytes inside a block of size 768 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x5392BC: ??? (in /usr/bin/python2.7) -==19285== by 0x4A991B: ??? (in /usr/bin/python2.7) -==19285== by 0x4AA177: ??? (in /usr/bin/python2.7) -==19285== by 0x4C88F0: PySymtable_Build (in /usr/bin/python2.7) -==19285== by 0x47E032: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x515136: ??? (in /usr/bin/python2.7) -==19285== by 0x4AFC43: ??? (in /usr/bin/python2.7) -==19285== by 0x47C2FB: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== Address 0x643c020 is 16 bytes inside a block of size 32 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x4A0323: ??? (in /usr/bin/python2.7) -==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) -==19285== by 0x5A5092: ??? (in /usr/bin/python2.7) -==19285== by 0x57929C: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== Address 0x643d020 is 688 bytes inside a block of size 1,536 free'd -==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x515136: ??? (in /usr/bin/python2.7) -==19285== by 0x4AFC43: ??? (in /usr/bin/python2.7) -==19285== by 0x47C2FB: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x53A541: ??? (in /usr/bin/python2.7) -==19285== by 0x55C5B8: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x4CD49D: ??? (in /usr/bin/python2.7) -==19285== by 0x55DBEB: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== Address 0x6428020 is 1,488 bytes inside a block of size 1,559 free'd -==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x50C437: _PyString_Resize (in /usr/bin/python2.7) -==19285== by 0x472AA4: ??? (in /usr/bin/python2.7) -==19285== by 0x4733C9: ??? (in /usr/bin/python2.7) -==19285== by 0x530824: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x50C437: _PyString_Resize (in /usr/bin/python2.7) -==19285== by 0x472AA4: ??? (in /usr/bin/python2.7) -==19285== by 0x4733C9: ??? (in /usr/bin/python2.7) -==19285== by 0x530824: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== Address 0x6496020 is 16 bytes after a block of size 48 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x46E3B6: ??? (in /usr/bin/python2.7) -==19285== by 0x52CCBB: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) -==19285== -==19285== Conditional jump or move depends on uninitialised value(s) -==19285== at 0x5BB279: ??? (in /usr/bin/python2.7) -==19285== by 0x5377E7: PyNode_AddChild (in /usr/bin/python2.7) -==19285== by 0x537E6E: PyParser_AddToken (in /usr/bin/python2.7) -==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== -==19285== Use of uninitialised value of size 8 -==19285== at 0x5BB28E: ??? (in /usr/bin/python2.7) -==19285== by 0x5377E7: PyNode_AddChild (in /usr/bin/python2.7) -==19285== by 0x537E6E: PyParser_AddToken (in /usr/bin/python2.7) -==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x54B87B: ??? (in /usr/bin/python2.7) -==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) -==19285== by 0x54B791: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== Address 0x5f3e020 is 0 bytes after a block of size 656 alloc'd -==19285== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x517A39: _PyObject_GC_NewVar (in /usr/bin/python2.7) -==19285== by 0x4F3142: PyFrame_New (in /usr/bin/python2.7) -==19285== by 0x52CE52: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) -==19285== by 0x54B791: ??? (in /usr/bin/python2.7) -==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) -==19285== by 0x54B791: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DD5A: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== Address 0x6461020 is 272 bytes inside a block of size 464 free'd -==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x4E5C58: PyList_Append (in /usr/bin/python2.7) -==19285== by 0x4A3DD3: ??? (in /usr/bin/python2.7) -==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) -==19285== by 0x4A409B: ??? (in /usr/bin/python2.7) -==19285== by 0x4A3F32: ??? (in /usr/bin/python2.7) -==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) -==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) -==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) -==19285== by 0x585CD5: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) -==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) -==19285== by 0x54B7B5: ??? (in /usr/bin/python2.7) -==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) -==19285== by 0x54B791: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DD5A: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== Address 0x6466020 is 2,016 bytes inside a block of size 2,152 free'd -==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x4E5C58: PyList_Append (in /usr/bin/python2.7) -==19285== by 0x4A3DD3: ??? (in /usr/bin/python2.7) -==19285== by 0x4A4104: ??? (in /usr/bin/python2.7) -==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) -==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) -==19285== by 0x4A3FA7: ??? (in /usr/bin/python2.7) -==19285== by 0x4A4085: ??? (in /usr/bin/python2.7) -==19285== by 0x585CD5: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) -==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x54B87B: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x46B0E6: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== Address 0x60d8020 is 32 bytes inside a block of size 200 free'd -==19285== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x4E5C58: PyList_Append (in /usr/bin/python2.7) -==19285== by 0x4A3DD3: ??? (in /usr/bin/python2.7) -==19285== by 0x4A3F09: ??? (in /usr/bin/python2.7) -==19285== by 0x4A409B: ??? (in /usr/bin/python2.7) -==19285== by 0x585CD5: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7) -==19285== by 0x585D7F: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== by 0x46B0E6: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D77B: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x5AC787: _PyObject_GC_Resize (in /usr/bin/python2.7) -==19285== by 0x4F31AF: PyFrame_New (in /usr/bin/python2.7) -==19285== by 0x52CE52: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== Address 0x650d020 is 0 bytes inside a block of size 32 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x56EBAB: ??? (in /usr/bin/python2.7) -==19285== by 0x53A572: ??? (in /usr/bin/python2.7) -==19285== by 0x55C5B8: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Conditional jump or move depends on uninitialised value(s) -==19285== at 0x5BB279: ??? (in /usr/bin/python2.7) -==19285== by 0x537DEC: PyParser_AddToken (in /usr/bin/python2.7) -==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== -==19285== Use of uninitialised value of size 8 -==19285== at 0x5BB28E: ??? (in /usr/bin/python2.7) -==19285== by 0x537DEC: PyParser_AddToken (in /usr/bin/python2.7) -==19285== by 0x52B4B6: ??? (in /usr/bin/python2.7) -==19285== by 0x52BE22: PyParser_ASTFromString (in /usr/bin/python2.7) -==19285== by 0x52BFFB: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x4AF42F: ??? (in /usr/bin/python2.7) -==19285== by 0x4B0299: ??? (in /usr/bin/python2.7) -==19285== by 0x47A1A9: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== Address 0x82b7020 is 8 bytes after a block of size 152 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x477035: ??? (in /usr/bin/python2.7) -==19285== by 0x47761B: ??? (in /usr/bin/python2.7) -==19285== by 0x5791A7: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x47840F: ??? (in /usr/bin/python2.7) -==19285== by 0x47C2C0: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== Address 0x82b9020 is 752 bytes inside a block of size 768 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x573D7A: ??? (in /usr/bin/python2.7) -==19285== by 0x47A16D: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x54B87B: ??? (in /usr/bin/python2.7) -==19285== by 0x52C073: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== by 0x5B7449: PyImport_ExecCodeModuleEx (in /usr/bin/python2.7) -==19285== by 0x579F0E: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) -==19285== Address 0x67ec020 is 0 bytes inside a block of size 64 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x5392FE: ??? (in /usr/bin/python2.7) -==19285== by 0x497381: ??? (in /usr/bin/python2.7) -==19285== by 0x539AAB: ??? (in /usr/bin/python2.7) -==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) -==19285== by 0x538F26: ??? (in /usr/bin/python2.7) -==19285== by 0x539AAB: ??? (in /usr/bin/python2.7) -==19285== by 0x5392FE: ??? (in /usr/bin/python2.7) -==19285== by 0x497381: ??? (in /usr/bin/python2.7) -==19285== by 0x538FE2: ??? (in /usr/bin/python2.7) -==19285== by 0x538F26: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x515136: ??? (in /usr/bin/python2.7) -==19285== by 0x4AFC43: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== Address 0x833d020 is 0 bytes inside a block of size 32 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x539994: ??? (in /usr/bin/python2.7) -==19285== by 0x4A0323: ??? (in /usr/bin/python2.7) -==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x4AF42F: ??? (in /usr/bin/python2.7) -==19285== by 0x47986C: ??? (in /usr/bin/python2.7) -==19285== by 0x477FFE: ??? (in /usr/bin/python2.7) -==19285== by 0x47C2C0: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== Address 0x833f020 is 208 bytes inside a block of size 320 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x4EC48C: PyCode_Optimize (in /usr/bin/python2.7) -==19285== by 0x4A0126: ??? (in /usr/bin/python2.7) -==19285== by 0x47A15C: ??? (in /usr/bin/python2.7) -==19285== by 0x47C3A3: ??? (in /usr/bin/python2.7) -==19285== by 0x579252: ??? (in /usr/bin/python2.7) -==19285== by 0x47C403: ??? (in /usr/bin/python2.7) -==19285== by 0x47E351: PyAST_Compile (in /usr/bin/python2.7) -==19285== by 0x52C017: PyRun_StringFlags (in /usr/bin/python2.7) -==19285== by 0x53173E: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x54000E: PyObject_Free (in /usr/bin/python2.7) -==19285== by 0x54B76E: ??? (in /usr/bin/python2.7) -==19285== by 0x579F2C: ??? (in /usr/bin/python2.7) -==19285== by 0x46B0E6: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x5B7391: PyEval_EvalCode (in /usr/bin/python2.7) -==19285== Address 0x83b5020 is 54,752 bytes inside a block of size 57,245 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x585D8A: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7) -==19285== by 0x585DBD: ??? (in /usr/bin/python2.7) -==19285== by 0x579EC4: ??? (in /usr/bin/python2.7) -==19285== by 0x46B0E6: ??? (in /usr/bin/python2.7) -==19285== by 0x55D3A2: ??? (in /usr/bin/python2.7) -==19285== by 0x55D82F: ??? (in /usr/bin/python2.7) -==19285== by 0x55DB36: PyImport_ImportModuleLevel (in /usr/bin/python2.7) -==19285== by 0x4755E6: ??? (in /usr/bin/python2.7) -==19285== by 0x4DA20A: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7) -==19285== by 0x52E6D6: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x56E90A: PyObject_GC_Del (in /usr/bin/python2.7) -==19285== by 0x538FC6: ??? (in /usr/bin/python2.7) -==19285== by 0x5390E0: ??? (in /usr/bin/python2.7) -==19285== by 0x52C94D: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x56D0A9: ??? (in /usr/bin/python2.7) -==19285== by 0x4D9853: ??? (in /usr/bin/python2.7) -==19285== by 0x4D8378: ??? (in /usr/bin/python2.7) -==19285== by 0x4F5D0A: ??? (in /usr/bin/python2.7) -==19285== by 0x52CC1F: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x56D0A9: ??? (in /usr/bin/python2.7) -==19285== Address 0x85f1020 is 0 bytes after a block of size 768 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x527BFF: ??? (in /usr/bin/python2.7) -==19285== by 0x4AD36B: _PyObject_GenericSetAttrWithDict (in /usr/bin/python2.7) -==19285== by 0x4CED55: ??? (in /usr/bin/python2.7) -==19285== by 0x4CF1B6: ??? (in /usr/bin/python2.7) -==19285== by 0x52C6D4: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x56D0A9: ??? (in /usr/bin/python2.7) -==19285== by 0x4D9853: ??? (in /usr/bin/python2.7) -==19285== by 0x4D8378: ??? (in /usr/bin/python2.7) -==19285== by 0x4F5D0A: ??? (in /usr/bin/python2.7) -==19285== -==19285== Invalid read of size 4 -==19285== at 0x5BB270: ??? (in /usr/bin/python2.7) -==19285== by 0x5AC787: _PyObject_GC_Resize (in /usr/bin/python2.7) -==19285== by 0x4F31AF: PyFrame_New (in /usr/bin/python2.7) -==19285== by 0x56CE48: ??? (in /usr/bin/python2.7) -==19285== by 0x4D9853: ??? (in /usr/bin/python2.7) -==19285== by 0x54A327: PyObject_CallFunctionObjArgs (in /usr/bin/python2.7) -==19285== by 0x598B5A: ??? (in /usr/bin/python2.7) -==19285== by 0x4CE73C: ??? (in /usr/bin/python2.7) -==19285== by 0x4A1F81: ??? (in /usr/bin/python2.7) -==19285== by 0x52C6D4: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x56D0A9: ??? (in /usr/bin/python2.7) -==19285== by 0x4D9853: ??? (in /usr/bin/python2.7) -==19285== Address 0x111c9020 is 0 bytes after a block of size 16 free'd -==19285== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) -==19285== by 0x6F3FCCA: g_slice_free_chain_with_offset (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0) -==19285== by 0x6C9E22B: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) -==19285== by 0x6C9DFD2: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) -==19285== by 0x6CA1BA4: g_object_set_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) -==19285== by 0x6CA2396: g_object_set (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) -==19285== by 0x892D4DD: vips_object_free_argument (object.c:937) -==19285== by 0x892CBBE: vips_argument_map (object.c:568) -==19285== by 0x892D50D: vips_argument_free_all (object.c:957) -==19285== by 0x892D572: vips_object_dispose (object.c:989) -==19285== by 0x8944330: vips_operation_dispose (operation.c:220) -==19285== by 0x8950870: vips_system_dispose (system.c:108) -==19285== -==19285== Invalid read of size 8 -==19285== at 0x683B580: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) -==19285== by 0x683A8CC: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) -==19285== by 0x683688B: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) -==19285== by 0x682C82D: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) -==19285== by 0x52CC1F: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== Address 0x0 is not stack'd, malloc'd or (recently) free'd -==19285== -==19285== -==19285== Process terminating with default action of signal 11 (SIGSEGV) -==19285== Access not within mapped region at address 0x0 -==19285== at 0x683B580: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) -==19285== by 0x683A8CC: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) -==19285== by 0x683688B: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) -==19285== by 0x682C82D: ??? (in /usr/lib/python2.7/dist-packages/gi/_gi.so) -==19285== by 0x52CC1F: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x52CF31: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== by 0x55C593: PyEval_EvalCodeEx (in /usr/bin/python2.7) -==19285== by 0x52CA8C: PyEval_EvalFrameEx (in /usr/bin/python2.7) -==19285== If you believe this happened as a result of a stack -==19285== overflow in your program's main thread (unlikely but -==19285== possible), you can try to increase the size of the -==19285== main thread stack using the --main-stacksize= flag. -==19285== The main thread stack size used in this run was 8388608. -==19285== -==19285== HEAP SUMMARY: -==19285== in use at exit: 9,373,405 bytes in 24,848 blocks -==19285== total heap usage: 105,481 allocs, 80,633 frees, 21,521,301 bytes allocated -==19285== -==19285== LEAK SUMMARY: -==19285== definitely lost: 0 bytes in 0 blocks -==19285== indirectly lost: 0 bytes in 0 blocks -==19285== possibly lost: 32,894 bytes in 58 blocks -==19285== still reachable: 3,243,770 bytes in 7,814 blocks -==19285== suppressed: 5,843,669 bytes in 15,154 blocks -==19285== Rerun with --leak-check=full to see details of leaked memory -==19285== -==19285== For counts of detected and suppressed errors, rerun with: -v -==19285== Use --track-origins=yes to see where uninitialised values come from -==19285== ERROR SUMMARY: 495 errors from 42 contexts (suppressed: 0 from 0) diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index 82acb2ce..789265c5 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -15,26 +15,111 @@ formats = [Vips.BandFormat.UCHAR, Vips.BandFormat.UINT, Vips.BandFormat.INT, Vips.BandFormat.FLOAT, - Vips.BandFormat.DOUBLE, - Vips.BandFormat.COMPLEX, - Vips.BandFormat.DPCOMPLEX] + Vips.BandFormat.DOUBLE] +cformats = [Vips.BandFormat.COMPLEX, + Vips.BandFormat.DPCOMPLEX] +all_formats = formats + cformats; + +black = Vips.Image.black(100, 100) +red = black.copy() +green = black.copy() +blue = black.copy() +red.draw_circle(100, 50, 50, 40, fill = True) +green.draw_circle(128, 50, 50, 40, fill = True) +blue.draw_circle(140, 50, 50, 40, fill = True) +colour = Vips.Image.bandjoin([red, green, blue]) +all_images = [green, colour] + +# an expanding zip ... if either of the args is not a list, duplicate it down +# the other +def zip_expand(x, y): + if isinstance(x, list) and isinstance(y, list): + return zip(x, y) + elif isinstance(x, list): + return [[i, y] for i in x] + elif isinstance(y, list): + return [[x, j] for j in y] + else: + return [[x, y]] + +# run a 2-ary function on two things -- loop over elements pairwise if the +# things are lists +def run_fn2(fn, x, y): + if isinstance(x, Vips.Image) or isinstance(y, Vips.Image): + return fn(x, y) + elif isinstance(x, list) or isinstance(y, list): + return [fn(i, j) for i, j in zip_expand(x, y)] + else: + return fn(x, y) class TestArithmetic(unittest.TestCase): - def setUp(self): - black = Vips.Image.black(100, 100) - mono = black.draw_circle(128, 50, 50, 50) - colour = Vips.Image.bandjoin([black, mono, black]) - images = [black, mono, colour] + # test a pait of things which can be lists + def assertAlmostEqualObjects(self, a, b, msg = ''): + [self.assertAlmostEqual(x, y, places = 2, msg = msg) + for x, y in zip_expand(a, b)] - self.test_set = [x.cast(y) for x in images for y in formats] - self.avgs = [x.avg() for x in self.test_set] + # run a function on (image, constant), and on (constant, image). + def run_testconst(self, message, fn, im, c): + before = im.getpoint(50, 50) + im1 = fn(c, im) + im2 = fn(im, c) + after1 = im1.getpoint(50, 50) + after2 = im2.getpoint(50, 50) + c1 = run_fn2(fn, c, before) + c2 = run_fn2(fn, before, c) + self.assertAlmostEqualObjects(after1, c1, msg = message) + self.assertAlmostEqualObjects(after2, c2, msg = message) - def test_addconst(self): - def add12(x): - return x + 12 + def run_arith_const(self, fn, fmt = all_formats): + [self.run_testconst(fn.func_name + ' scalar', fn, x.cast(y), 12) + for x in all_images for y in fmt] + [self.run_testconst(fn.func_name + ' vector', fn, colour.cast(y), + [12, 13, 14]) + for y in formats] - self.assertEqual([add12(x).avg() for x in self.test_set], - [add12(x) for x in self.avgs]) + # run a function on (image, image) + def run_testim(self, message, fn, left, right): + before_left = left.getpoint(50, 50) + before_right = right.getpoint(50, 50) + im2 = fn(left, right) + after = im2.getpoint(50, 50) + after_c = run_fn2(fn, before_left, before_right) + self.assertAlmostEqualObjects(after, after_c, msg = message) + + def run_arith(self, fn, fmt = all_formats): + [self.run_testim(fn.func_name + ' image', fn, x.cast(y), x.cast(z)) + for x in all_images for y in fmt for z in fmt] + + def test_add(self): + def add(x, y): + return x + y + + self.run_arith_const(add) + self.run_arith(add) + + def test_sub(self): + def sub(x, y): + return x - y + + self.run_arith_const(sub) + self.run_arith(sub) + + def test_mul(self): + def mul(x, y): + return x * y + + self.run_arith_const(mul) + self.run_arith(mul) + + def test_div(self): + def div(x, y): + return x / y + + # div(const / image) needs (image ** -1), which won't work for complex + # images ... just test with non-complex + self.run_arith_const(div, fmt = formats) + + self.run_arith(div) if __name__ == '__main__': unittest.main() diff --git a/python/vips8/vips.py b/python/vips8/vips.py index c193a0f6..375c2a66 100644 --- a/python/vips8/vips.py +++ b/python/vips8/vips.py @@ -21,6 +21,13 @@ vips_type_blob = GObject.GType.from_name("VipsBlob") vips_type_image = GObject.GType.from_name("VipsImage") vips_type_operation = GObject.GType.from_name("VipsOperation") +unpack_types = [Vips.Blob, Vips.ArrayDouble, Vips.ArrayImage, Vips.ArrayInt] +def isunpack(obj): + for t in unpack_types: + if isinstance(obj, t): + return True + return False + class Error(Exception): """An error from vips. @@ -81,10 +88,10 @@ class Argument: logging.debug('read out %s from %s' % (value, self.name)) - # turn VipsBlobs into strings + # turn VipsBlobs into strings, VipsArrayDouble into lists etc. # FIXME ... this will involve a copy, we should use # buffer() instead - if isinstance(value, Vips.Blob): + if isunpack(value): value = value.get() return value @@ -285,6 +292,9 @@ def vips_image_write_to_buffer(self, vips_filename, **kwargs): return _call_base(saver, [], kwargs, self, option_string) +def vips_bandsplit(self): + return [self.extract_band(i) for i in range(0, self.bands)] + # apply a function to a thing, or map over a list # we often need to do something like (1.0 / other) and need to work for lists # as well as scalars @@ -444,8 +454,11 @@ Vips.Image.write_to_file = vips_image_write_to_file Vips.Image.write_to_buffer = vips_image_write_to_buffer # we can use Vips.Image.write_to_memory() directly +# a few useful things Vips.Image.floor = vips_floor +Vips.Image.bandsplit = vips_bandsplit +# operator overloads Vips.Image.__getattr__ = vips_image_getattr Vips.Image.__add__ = vips_add Vips.Image.__radd__ = vips_add From 8a1397b91fb8823cf117c93fccbd2be4770270a5 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 13 Sep 2014 17:24:59 +0100 Subject: [PATCH 08/14] small python fixes --- libvips/create/create.c | 3 + libvips/create/mask_ideal.c | 2 + python/test_arithmetic.py | 113 +++++++++++++++++++++++------------- python/vips8/vips.py | 14 +++-- 4 files changed, 87 insertions(+), 45 deletions(-) diff --git a/libvips/create/create.c b/libvips/create/create.c index 52ab9cb8..77ef0ccc 100644 --- a/libvips/create/create.c +++ b/libvips/create/create.c @@ -128,10 +128,13 @@ vips_create_operation_init( void ) extern GType vips_invertlut_get_type( void ); extern GType vips_tonelut_get_type( void ); extern GType vips_identity_get_type( void ); + extern GType vips_mask_butterworth_get_type( void ); extern GType vips_mask_butterworth_ring_get_type( void ); extern GType vips_mask_butterworth_band_get_type( void ); + extern GType vips_mask_gaussian_get_type( void ); extern GType vips_mask_gaussian_ring_get_type( void ); extern GType vips_mask_gaussian_band_get_type( void ); + extern GType vips_mask_ideal_get_type( void ); extern GType vips_mask_ideal_ring_get_type( void ); extern GType vips_mask_ideal_band_get_type( void ); extern GType vips_mask_fractal_get_type( void ); diff --git a/libvips/create/mask_ideal.c b/libvips/create/mask_ideal.c index 54625e75..e0b170c1 100644 --- a/libvips/create/mask_ideal.c +++ b/libvips/create/mask_ideal.c @@ -72,6 +72,8 @@ vips_mask_ideal_class_init( VipsMaskIdealClass *class ) VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class ); VipsMaskClass *mask_class = VIPS_MASK_CLASS( class ); + printf( "vips_mask_ideal_class_init\n" ); + gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index 789265c5..4195dbff 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -2,8 +2,8 @@ import unittest -#import logging -#logging.basicConfig(level = logging.DEBUG) +import logging +logging.basicConfig(level = logging.DEBUG) from gi.repository import Vips from vips8 import vips @@ -20,15 +20,10 @@ cformats = [Vips.BandFormat.COMPLEX, Vips.BandFormat.DPCOMPLEX] all_formats = formats + cformats; -black = Vips.Image.black(100, 100) -red = black.copy() -green = black.copy() -blue = black.copy() -red.draw_circle(100, 50, 50, 40, fill = True) -green.draw_circle(128, 50, 50, 40, fill = True) -blue.draw_circle(140, 50, 50, 40, fill = True) -colour = Vips.Image.bandjoin([red, green, blue]) -all_images = [green, colour] +im = Vips.Image.mask_ideal(100, 100, 0.5) +colour = im * [100, 128, 140] + [20, 30, 40] +mono = colour.extract_band(1) +all_images = [mono, colour] # an expanding zip ... if either of the args is not a list, duplicate it down # the other @@ -42,6 +37,16 @@ def zip_expand(x, y): else: return [[x, y]] +# run a 1-ary function on a thing -- loop over elements if the +# thing is a list +def run_fn(fn, x): + if isinstance(x, Vips.Image) : + return fn(x) + elif isinstance(x, list): + return [fn(i) for i in x] + else: + return fn(x) + # run a 2-ary function on two things -- loop over elements pairwise if the # things are lists def run_fn2(fn, x, y): @@ -53,22 +58,28 @@ def run_fn2(fn, x, y): return fn(x, y) class TestArithmetic(unittest.TestCase): - # test a pait of things which can be lists + # test a pair of things which can be lists for approx. equality def assertAlmostEqualObjects(self, a, b, msg = ''): [self.assertAlmostEqual(x, y, places = 2, msg = msg) for x, y in zip_expand(a, b)] + # run a function on an image and on a single pixel, the results + # should match + def run_cmp(self, message, im, x, y, fn): + a = im.getpoint(x, y) + v1 = fn(a) + im2 = fn(im) + v2 = im2.getpoint(x, y) + #print 'self.assertAlmostEqualObjects: %s = %s' % (v1, v2) + self.assertAlmostEqualObjects(v1, v2, msg = message) + # run a function on (image, constant), and on (constant, image). + # 50,50 and 10,10 should have different values on the test image def run_testconst(self, message, fn, im, c): - before = im.getpoint(50, 50) - im1 = fn(c, im) - im2 = fn(im, c) - after1 = im1.getpoint(50, 50) - after2 = im2.getpoint(50, 50) - c1 = run_fn2(fn, c, before) - c2 = run_fn2(fn, before, c) - self.assertAlmostEqualObjects(after1, c1, msg = message) - self.assertAlmostEqualObjects(after2, c2, msg = message) + self.run_cmp(message, im, 50, 50, lambda x: run_fn2(fn, x, c)) + self.run_cmp(message, im, 50, 50, lambda x: run_fn2(fn, c, x)) + self.run_cmp(message, im, 10, 10, lambda x: run_fn2(fn, x, c)) + self.run_cmp(message, im, 10, 10, lambda x: run_fn2(fn, c, x)) def run_arith_const(self, fn, fmt = all_formats): [self.run_testconst(fn.func_name + ' scalar', fn, x.cast(y), 12) @@ -77,39 +88,48 @@ class TestArithmetic(unittest.TestCase): [12, 13, 14]) for y in formats] - # run a function on (image, image) - def run_testim(self, message, fn, left, right): - before_left = left.getpoint(50, 50) - before_right = right.getpoint(50, 50) - im2 = fn(left, right) - after = im2.getpoint(50, 50) - after_c = run_fn2(fn, before_left, before_right) - self.assertAlmostEqualObjects(after, after_c, msg = message) + # run a function on a pair of images and on a pair of pixels, the results + # should match + def run_cmp2(self, message, left, right, x, y, fn): + a = left.getpoint(x, y) + b = right.getpoint(x, y) + v1 = fn(a, b) + after = fn(left, right) + v2 = after.getpoint(x, y) + self.assertAlmostEqualObjects(v1, v2, msg = message) + + # run a function on a pair of images + # 50,50 and 10,10 should have different values on the test image + def run_test2(self, message, left, right, fn): + self.run_cmp2(message, left, right, 50, 50, + lambda x, y: run_fn2(fn, x, y)) + self.run_cmp2(message, left, right, 10, 10, + lambda x, y: run_fn2(fn, x, y)) def run_arith(self, fn, fmt = all_formats): - [self.run_testim(fn.func_name + ' image', fn, x.cast(y), x.cast(z)) + [self.run_test2(fn.func_name + ' image', x.cast(y), x.cast(z), fn) for x in all_images for y in fmt for z in fmt] def test_add(self): def add(x, y): return x + y - self.run_arith_const(add) - self.run_arith(add) + #self.run_arith_const(add) + #self.run_arith(add) def test_sub(self): def sub(x, y): return x - y - self.run_arith_const(sub) - self.run_arith(sub) + #self.run_arith_const(sub) + #self.run_arith(sub) def test_mul(self): def mul(x, y): return x * y - self.run_arith_const(mul) - self.run_arith(mul) + #self.run_arith_const(mul) + #self.run_arith(mul) def test_div(self): def div(x, y): @@ -117,10 +137,25 @@ class TestArithmetic(unittest.TestCase): # div(const / image) needs (image ** -1), which won't work for complex # images ... just test with non-complex - self.run_arith_const(div, fmt = formats) + #self.run_arith_const(div, fmt = formats) + #self.run_arith(div) - self.run_arith(div) + # run a function on an image, + # 50,50 and 10,10 should have different values on the test image + def run_testunary(self, message, im, fn): + self.run_cmp(message, im, 50, 50, lambda x: run_fn(fn, x)) + self.run_cmp(message, im, 10, 10, lambda x: run_fn(fn, x)) + + def run_unary(self, fn, images = all_images, fmt = all_formats): + [self.run_testunary(fn.func_name + ' image', x.cast(y), fn) + for x in images for y in fmt] + + def test_abs(self): + def my_abs(x): + return abs(x) + + #im = -mono; + #self.run_unary(my_abs, [im]) if __name__ == '__main__': unittest.main() - diff --git a/python/vips8/vips.py b/python/vips8/vips.py index 375c2a66..b64dc297 100644 --- a/python/vips8/vips.py +++ b/python/vips8/vips.py @@ -425,13 +425,9 @@ def vips_image_class_method(name, args, kwargs): return _call_base(name, args, kwargs) def define_class_methods(cls): - if len(cls.children) > 0: - for child in cls.children: - # not easy to get at the deprecated flag in an abtract type? - if cls.name != 'VipsWrap7': - define_class_methods(child) - elif cls.is_instantiatable(): + if not cls.is_abstract(): op = Vips.Operation.new(cls.name) + found = False for prop in op.props: flags = op.get_argument_flags(prop.name) @@ -447,6 +443,12 @@ def define_class_methods(cls): method = lambda *args, **kwargs: vips_image_class_method( nickname, args, kwargs) setattr(Vips.Image, nickname, classmethod(method)) + if len(cls.children) > 0: + for child in cls.children: + # not easy to get at the deprecated flag in an abtract type? + if cls.name != 'VipsWrap7': + define_class_methods(child) + define_class_methods(vips_type_operation) # instance methods From ce8d7e57892652a65d986722d31d788dcb835b23 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 13 Sep 2014 18:03:25 +0100 Subject: [PATCH 09/14] tweaks --- libvips/create/mask_ideal.c | 2 -- python/test_arithmetic.py | 46 ++++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/libvips/create/mask_ideal.c b/libvips/create/mask_ideal.c index e0b170c1..54625e75 100644 --- a/libvips/create/mask_ideal.c +++ b/libvips/create/mask_ideal.c @@ -72,8 +72,6 @@ vips_mask_ideal_class_init( VipsMaskIdealClass *class ) VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class ); VipsMaskClass *mask_class = VIPS_MASK_CLASS( class ); - printf( "vips_mask_ideal_class_init\n" ); - gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index 4195dbff..54c0d7f8 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -1,9 +1,10 @@ #!/usr/bin/python import unittest +import gc -import logging -logging.basicConfig(level = logging.DEBUG) +#import logging +#logging.basicConfig(level = logging.DEBUG) from gi.repository import Vips from vips8 import vips @@ -20,11 +21,6 @@ cformats = [Vips.BandFormat.COMPLEX, Vips.BandFormat.DPCOMPLEX] all_formats = formats + cformats; -im = Vips.Image.mask_ideal(100, 100, 0.5) -colour = im * [100, 128, 140] + [20, 30, 40] -mono = colour.extract_band(1) -all_images = [mono, colour] - # an expanding zip ... if either of the args is not a list, duplicate it down # the other def zip_expand(x, y): @@ -83,8 +79,8 @@ class TestArithmetic(unittest.TestCase): def run_arith_const(self, fn, fmt = all_formats): [self.run_testconst(fn.func_name + ' scalar', fn, x.cast(y), 12) - for x in all_images for y in fmt] - [self.run_testconst(fn.func_name + ' vector', fn, colour.cast(y), + for x in self.all_images for y in fmt] + [self.run_testconst(fn.func_name + ' vector', fn, self.colour.cast(y), [12, 13, 14]) for y in formats] @@ -108,28 +104,34 @@ class TestArithmetic(unittest.TestCase): def run_arith(self, fn, fmt = all_formats): [self.run_test2(fn.func_name + ' image', x.cast(y), x.cast(z), fn) - for x in all_images for y in fmt for z in fmt] + for x in self.all_images for y in fmt for z in fmt] + + def setUp(self): + im = Vips.Image.mask_ideal(100, 100, 0.5) + self.colour = im * [100, 128, 140] + [20, 30, 40] + self.mono = self.colour.extract_band(1) + self.all_images = [self.mono, self.colour] def test_add(self): def add(x, y): return x + y - #self.run_arith_const(add) - #self.run_arith(add) + self.run_arith_const(add) + self.run_arith(add) def test_sub(self): def sub(x, y): return x - y - #self.run_arith_const(sub) - #self.run_arith(sub) + self.run_arith_const(sub) + self.run_arith(sub) def test_mul(self): def mul(x, y): return x * y - #self.run_arith_const(mul) - #self.run_arith(mul) + self.run_arith_const(mul) + self.run_arith(mul) def test_div(self): def div(x, y): @@ -137,8 +139,8 @@ class TestArithmetic(unittest.TestCase): # div(const / image) needs (image ** -1), which won't work for complex # images ... just test with non-complex - #self.run_arith_const(div, fmt = formats) - #self.run_arith(div) + self.run_arith_const(div, fmt = formats) + self.run_arith(div) # run a function on an image, # 50,50 and 10,10 should have different values on the test image @@ -146,7 +148,7 @@ class TestArithmetic(unittest.TestCase): self.run_cmp(message, im, 50, 50, lambda x: run_fn(fn, x)) self.run_cmp(message, im, 10, 10, lambda x: run_fn(fn, x)) - def run_unary(self, fn, images = all_images, fmt = all_formats): + def run_unary(self, images, fn, fmt = all_formats): [self.run_testunary(fn.func_name + ' image', x.cast(y), fn) for x in images for y in fmt] @@ -154,8 +156,10 @@ class TestArithmetic(unittest.TestCase): def my_abs(x): return abs(x) - #im = -mono; - #self.run_unary(my_abs, [im]) + im = -self.mono; + #self.run_unary([im], my_abs) + + self.run_cmp('poop', im, 50, 50, lambda x: run_fn(my_abs, im)) if __name__ == '__main__': unittest.main() From 2c1c9b94fedc6d89292db9348d224a38c8e0b920 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 13 Sep 2014 19:49:03 +0100 Subject: [PATCH 10/14] abs unittest done --- python/test_arithmetic.py | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index 54c0d7f8..4e43ec0e 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -9,17 +9,19 @@ import gc from gi.repository import Vips from vips8 import vips -formats = [Vips.BandFormat.UCHAR, - Vips.BandFormat.CHAR, - Vips.BandFormat.USHORT, - Vips.BandFormat.SHORT, - Vips.BandFormat.UINT, - Vips.BandFormat.INT, - Vips.BandFormat.FLOAT, - Vips.BandFormat.DOUBLE] -cformats = [Vips.BandFormat.COMPLEX, - Vips.BandFormat.DPCOMPLEX] -all_formats = formats + cformats; +unsigned_formats = [Vips.BandFormat.UCHAR, + Vips.BandFormat.USHORT, + Vips.BandFormat.UINT] +signed_formats = [Vips.BandFormat.CHAR, + Vips.BandFormat.SHORT, + Vips.BandFormat.INT] +float_formats = [Vips.BandFormat.FLOAT, + Vips.BandFormat.DOUBLE] +complex_formats = [Vips.BandFormat.COMPLEX, + Vips.BandFormat.DPCOMPLEX] +int_formats = unsigned_formats + signed_formats +noncomplex_formats = int_formats + float_formats +all_formats = int_formats + float_formats + complex_formats # an expanding zip ... if either of the args is not a list, duplicate it down # the other @@ -56,8 +58,8 @@ def run_fn2(fn, x, y): class TestArithmetic(unittest.TestCase): # test a pair of things which can be lists for approx. equality def assertAlmostEqualObjects(self, a, b, msg = ''): - [self.assertAlmostEqual(x, y, places = 2, msg = msg) - for x, y in zip_expand(a, b)] + for x, y in zip_expand(a, b): + self.assertAlmostEqual(x, y, places = 2, msg = msg) # run a function on an image and on a single pixel, the results # should match @@ -66,7 +68,6 @@ class TestArithmetic(unittest.TestCase): v1 = fn(a) im2 = fn(im) v2 = im2.getpoint(x, y) - #print 'self.assertAlmostEqualObjects: %s = %s' % (v1, v2) self.assertAlmostEqualObjects(v1, v2, msg = message) # run a function on (image, constant), and on (constant, image). @@ -82,7 +83,7 @@ class TestArithmetic(unittest.TestCase): for x in self.all_images for y in fmt] [self.run_testconst(fn.func_name + ' vector', fn, self.colour.cast(y), [12, 13, 14]) - for y in formats] + for y in fmt] # run a function on a pair of images and on a pair of pixels, the results # should match @@ -108,7 +109,7 @@ class TestArithmetic(unittest.TestCase): def setUp(self): im = Vips.Image.mask_ideal(100, 100, 0.5) - self.colour = im * [100, 128, 140] + [20, 30, 40] + self.colour = im * [10, 20, 30] + [20, 30, 40] self.mono = self.colour.extract_band(1) self.all_images = [self.mono, self.colour] @@ -139,7 +140,7 @@ class TestArithmetic(unittest.TestCase): # div(const / image) needs (image ** -1), which won't work for complex # images ... just test with non-complex - self.run_arith_const(div, fmt = formats) + self.run_arith_const(div, fmt = noncomplex_formats) self.run_arith(div) # run a function on an image, @@ -156,10 +157,8 @@ class TestArithmetic(unittest.TestCase): def my_abs(x): return abs(x) - im = -self.mono; - #self.run_unary([im], my_abs) - - self.run_cmp('poop', im, 50, 50, lambda x: run_fn(my_abs, im)) + im = -self.colour + self.run_unary([im], my_abs, fmt = signed_formats + float_formats) if __name__ == '__main__': unittest.main() From d0f7efcd1e8865e8136e495f676bbe9c2f33758f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 14 Sep 2014 11:51:05 +0100 Subject: [PATCH 11/14] self-test of all overloads done woo and it passes --- python/test_arithmetic.py | 83 +++++++++++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 8 deletions(-) diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index 4e43ec0e..921530c0 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -38,9 +38,7 @@ def zip_expand(x, y): # run a 1-ary function on a thing -- loop over elements if the # thing is a list def run_fn(fn, x): - if isinstance(x, Vips.Image) : - return fn(x) - elif isinstance(x, list): + if isinstance(x, list): return [fn(i) for i in x] else: return fn(x) @@ -59,7 +57,8 @@ class TestArithmetic(unittest.TestCase): # test a pair of things which can be lists for approx. equality def assertAlmostEqualObjects(self, a, b, msg = ''): for x, y in zip_expand(a, b): - self.assertAlmostEqual(x, y, places = 2, msg = msg) + #print 'assertAlmostEqual %s = %s' % (x, y) + self.assertAlmostEqual(x, y, places = 4, msg = msg) # run a function on an image and on a single pixel, the results # should match @@ -79,10 +78,10 @@ class TestArithmetic(unittest.TestCase): self.run_cmp(message, im, 10, 10, lambda x: run_fn2(fn, c, x)) def run_arith_const(self, fn, fmt = all_formats): - [self.run_testconst(fn.func_name + ' scalar', fn, x.cast(y), 12) + [self.run_testconst(fn.func_name + ' scalar', fn, x.cast(y), 2) for x in self.all_images for y in fmt] [self.run_testconst(fn.func_name + ' vector', fn, self.colour.cast(y), - [12, 13, 14]) + [1, 2, 3]) for y in fmt] # run a function on a pair of images and on a pair of pixels, the results @@ -109,10 +108,12 @@ class TestArithmetic(unittest.TestCase): def setUp(self): im = Vips.Image.mask_ideal(100, 100, 0.5) - self.colour = im * [10, 20, 30] + [20, 30, 40] + self.colour = im * [1, 2, 3] + [2, 3, 4] self.mono = self.colour.extract_band(1) self.all_images = [self.mono, self.colour] + # test all operator overloads we define + def test_add(self): def add(x, y): return x + y @@ -158,7 +159,73 @@ class TestArithmetic(unittest.TestCase): return abs(x) im = -self.colour - self.run_unary([im], my_abs, fmt = signed_formats + float_formats) + self.run_unary([im], my_abs, fmt = all_formats) + + def test_pow(self): + def my_pow(x, y): + return x ** y + + # (image ** x) won't work for complex images ... just test non-complex + self.run_arith_const(my_pow, fmt = noncomplex_formats) + self.run_arith(my_pow, fmt = noncomplex_formats) + + def test_lshift(self): + def my_lshift(x): + # python doesn't allow float << int + if isinstance(x, float): + x = int(x) + return x << 2 + + # we don't support constant << image, treat as a unary + self.run_unary(self.all_images, my_lshift, fmt = noncomplex_formats) + + def test_rshift(self): + def my_rshift(x): + # python doesn't allow float >> int + if isinstance(x, float): + x = int(x) + return x >> 2 + + # we don't support constant >> image, treat as a unary + self.run_unary(self.all_images, my_rshift, fmt = noncomplex_formats) + + def test_and(self): + def my_and(x, y): + # python doesn't allow bools on float + if isinstance(x, float): + x = int(x) + if isinstance(y, float): + y = int(y) + return x & y + + self.run_arith_const(my_and, fmt = noncomplex_formats) + self.run_arith(my_and, fmt = noncomplex_formats) + + def test_or(self): + def my_or(x, y): + # python doesn't allow bools on float + if isinstance(x, float): + x = int(x) + if isinstance(y, float): + y = int(y) + return x | y + + self.run_arith_const(my_or, fmt = noncomplex_formats) + self.run_arith(my_or, fmt = noncomplex_formats) + + def test_xor(self): + def my_xor(x, y): + # python doesn't allow bools on float + if isinstance(x, float): + x = int(x) + if isinstance(y, float): + y = int(y) + return x ^ y + + self.run_arith_const(my_xor, fmt = noncomplex_formats) + self.run_arith(my_xor, fmt = noncomplex_formats) + + # test the rest of VipsArithmetic if __name__ == '__main__': unittest.main() From d14a6ea2c7bc9f3d7fa467a2b5149e0567dd887f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 14 Sep 2014 13:16:36 +0100 Subject: [PATCH 12/14] test the last couple of overloads they are actually defined in terms of other overloads, but test them anyway --- python/test_arithmetic.py | 111 +++++++++++++++++++++++++------------- 1 file changed, 74 insertions(+), 37 deletions(-) diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index 921530c0..668ef323 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -139,27 +139,17 @@ class TestArithmetic(unittest.TestCase): def div(x, y): return x / y - # div(const / image) needs (image ** -1), which won't work for complex - # images ... just test with non-complex + # (const / image) needs (image ** -1), which won't work for complex self.run_arith_const(div, fmt = noncomplex_formats) self.run_arith(div) - # run a function on an image, - # 50,50 and 10,10 should have different values on the test image - def run_testunary(self, message, im, fn): - self.run_cmp(message, im, 50, 50, lambda x: run_fn(fn, x)) - self.run_cmp(message, im, 10, 10, lambda x: run_fn(fn, x)) + def test_floordiv(self): + def my_floordiv(x, y): + return x // y - def run_unary(self, images, fn, fmt = all_formats): - [self.run_testunary(fn.func_name + ' image', x.cast(y), fn) - for x in images for y in fmt] - - def test_abs(self): - def my_abs(x): - return abs(x) - - im = -self.colour - self.run_unary([im], my_abs, fmt = all_formats) + # (const // image) needs (image ** -1), which won't work for complex + self.run_arith_const(my_floordiv, fmt = noncomplex_formats) + self.run_arith(my_floordiv, fmt = noncomplex_formats) def test_pow(self): def my_pow(x, y): @@ -169,26 +159,6 @@ class TestArithmetic(unittest.TestCase): self.run_arith_const(my_pow, fmt = noncomplex_formats) self.run_arith(my_pow, fmt = noncomplex_formats) - def test_lshift(self): - def my_lshift(x): - # python doesn't allow float << int - if isinstance(x, float): - x = int(x) - return x << 2 - - # we don't support constant << image, treat as a unary - self.run_unary(self.all_images, my_lshift, fmt = noncomplex_formats) - - def test_rshift(self): - def my_rshift(x): - # python doesn't allow float >> int - if isinstance(x, float): - x = int(x) - return x >> 2 - - # we don't support constant >> image, treat as a unary - self.run_unary(self.all_images, my_rshift, fmt = noncomplex_formats) - def test_and(self): def my_and(x, y): # python doesn't allow bools on float @@ -225,6 +195,73 @@ class TestArithmetic(unittest.TestCase): self.run_arith_const(my_xor, fmt = noncomplex_formats) self.run_arith(my_xor, fmt = noncomplex_formats) + # run a function on an image, + # 50,50 and 10,10 should have different values on the test image + def run_testunary(self, message, im, fn): + self.run_cmp(message, im, 50, 50, lambda x: run_fn(fn, x)) + self.run_cmp(message, im, 10, 10, lambda x: run_fn(fn, x)) + + def run_unary(self, images, fn, fmt = all_formats): + [self.run_testunary(fn.func_name + ' image', x.cast(y), fn) + for x in images for y in fmt] + + def test_abs(self): + def my_abs(x): + return abs(x) + + im = -self.colour + self.run_unary([im], my_abs) + + def test_lshift(self): + def my_lshift(x): + # python doesn't allow float << int + if isinstance(x, float): + x = int(x) + return x << 2 + + # we don't support constant << image, treat as a unary + self.run_unary(self.all_images, my_lshift, fmt = noncomplex_formats) + + def test_rshift(self): + def my_rshift(x): + # python doesn't allow float >> int + if isinstance(x, float): + x = int(x) + return x >> 2 + + # we don't support constant >> image, treat as a unary + self.run_unary(self.all_images, my_rshift, fmt = noncomplex_formats) + + def test_mod(self): + def my_mod(x): + return x % 2 + + # we don't support constant % image, treat as a unary + self.run_unary(self.all_images, my_mod, fmt = noncomplex_formats) + + def test_pos(self): + def my_pos(x): + return +x + + self.run_unary(self.all_images, my_pos) + + def test_neg(self): + def my_neg(x): + return -x + + self.run_unary(self.all_images, my_neg) + + def test_invert(self): + def my_invert(x): + if isinstance(x, float): + x = int(x) + return ~x & 0xff + + # ~image is trimmed to image max so it's hard to test for all formats + # just test uchar + self.run_unary(self.all_images, my_invert, + fmt = [Vips.BandFormat.UCHAR]) + # test the rest of VipsArithmetic if __name__ == '__main__': From 876a7538af9e2a72f5d21cc00e8a4cf91152cd6c Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 14 Sep 2014 21:30:27 +0100 Subject: [PATCH 13/14] more tests --- TODO | 6 ++++++ python/test_arithmetic.py | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/TODO b/TODO index 95787836..87554027 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,12 @@ - python: + - this is very annoying: + + real = im.complexget(Vips.OperationComplexget.REAL) + + define im.real() and im.imag() + - could import like this: from gi.repository import Vips diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index 668ef323..258c2439 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -264,5 +264,47 @@ class TestArithmetic(unittest.TestCase): # test the rest of VipsArithmetic + def test_avg(self): + im = Vips.Image.black(50, 100) + test = im.insert(im + 100, 50, 0, expand = True) + + test.write_to_file("x.v") + + for fmt in all_formats: + self.assertAlmostEqual(test.cast(fmt).avg(), 50) + + def test_polar(self): + im = Vips.Image.black(100, 100) + 100 + im = im.complexform(im) + + im = im.complex(Vips.OperationComplex.POLAR) + + real = im.complexget(Vips.OperationComplexget.REAL) + self.assertAlmostEqual(real.avg(), 100 * 2 ** 0.5) + imag = im.complexget(Vips.OperationComplexget.IMAG) + self.assertAlmostEqual(imag.avg(), 45) + + def test_rect(self): + im = Vips.Image.black(100, 100) + im = (im + 100 * 2 ** 0.5).complexform(im + 45) + + im = im.complex(Vips.OperationComplex.RECT) + + real = im.complexget(Vips.OperationComplexget.REAL) + self.assertAlmostEqual(real.avg(), 100) + imag = im.complexget(Vips.OperationComplexget.IMAG) + self.assertAlmostEqual(imag.avg(), 100) + + def test_conjugate(self): + im = Vips.Image.black(100, 100) + 100 + im = im.complexform(im) + + im = im.complex(Vips.OperationComplex.CONJ) + + real = im.complexget(Vips.OperationComplexget.REAL) + self.assertAlmostEqual(real.avg(), 100) + imag = im.complexget(Vips.OperationComplexget.IMAG) + self.assertAlmostEqual(imag.avg(), -100) + if __name__ == '__main__': unittest.main() From cc599844d23a5df00134f157eb5732fb0466d86d Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 15 Sep 2014 09:06:36 +0100 Subject: [PATCH 14/14] fix getpoint(0,0) and add more tests --- TODO | 6 ++--- libvips/arithmetic/getpoint.c | 8 +++---- python/test_arithmetic.py | 43 +++++++++++++++++++++-------------- python/vips8/vips.py | 27 ++++++++++++++++------ 4 files changed, 53 insertions(+), 31 deletions(-) diff --git a/TODO b/TODO index 87554027..edc4b583 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,11 @@ - python: - - this is very annoying: + - try - real = im.complexget(Vips.OperationComplexget.REAL) + python test_arithmetic.py -v TestArithmetic.test_histfind - define im.real() and im.imag() + segv - could import like this: diff --git a/libvips/arithmetic/getpoint.c b/libvips/arithmetic/getpoint.c index b3a55303..4604cb40 100644 --- a/libvips/arithmetic/getpoint.c +++ b/libvips/arithmetic/getpoint.c @@ -151,17 +151,17 @@ vips_getpoint_class_init( VipsGetpointClass *class ) VIPS_ARG_INT( class, "x", 5, _( "x" ), - _( "Getpoint to read from" ), + _( "Point to read" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsGetpoint, x ), - 1, RANGE, 1 ); + 0, RANGE, 0 ); VIPS_ARG_INT( class, "y", 6, _( "y" ), - _( "Getpoint to read from" ), + _( "Point to read" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsGetpoint, y ), - 1, RANGE, 1 ); + 0, RANGE, 0 ); } diff --git a/python/test_arithmetic.py b/python/test_arithmetic.py index 258c2439..4d561f4f 100755 --- a/python/test_arithmetic.py +++ b/python/test_arithmetic.py @@ -268,43 +268,52 @@ class TestArithmetic(unittest.TestCase): im = Vips.Image.black(50, 100) test = im.insert(im + 100, 50, 0, expand = True) - test.write_to_file("x.v") - for fmt in all_formats: self.assertAlmostEqual(test.cast(fmt).avg(), 50) + def test_deviate(self): + im = Vips.Image.black(50, 100) + test = im.insert(im + 100, 50, 0, expand = True) + + for fmt in noncomplex_formats: + self.assertAlmostEqual(test.cast(fmt).deviate(), 50, places = 2) + def test_polar(self): im = Vips.Image.black(100, 100) + 100 im = im.complexform(im) - im = im.complex(Vips.OperationComplex.POLAR) + im = im.polar() - real = im.complexget(Vips.OperationComplexget.REAL) - self.assertAlmostEqual(real.avg(), 100 * 2 ** 0.5) - imag = im.complexget(Vips.OperationComplexget.IMAG) - self.assertAlmostEqual(imag.avg(), 45) + self.assertAlmostEqual(im.real().avg(), 100 * 2 ** 0.5) + self.assertAlmostEqual(im.imag().avg(), 45) def test_rect(self): im = Vips.Image.black(100, 100) im = (im + 100 * 2 ** 0.5).complexform(im + 45) - im = im.complex(Vips.OperationComplex.RECT) + im = im.rect() - real = im.complexget(Vips.OperationComplexget.REAL) - self.assertAlmostEqual(real.avg(), 100) - imag = im.complexget(Vips.OperationComplexget.IMAG) - self.assertAlmostEqual(imag.avg(), 100) + self.assertAlmostEqual(im.real().avg(), 100) + self.assertAlmostEqual(im.imag().avg(), 100) def test_conjugate(self): im = Vips.Image.black(100, 100) + 100 im = im.complexform(im) - im = im.complex(Vips.OperationComplex.CONJ) + im = im.conj() - real = im.complexget(Vips.OperationComplexget.REAL) - self.assertAlmostEqual(real.avg(), 100) - imag = im.complexget(Vips.OperationComplexget.IMAG) - self.assertAlmostEqual(imag.avg(), -100) + self.assertAlmostEqual(im.real().avg(), 100) + self.assertAlmostEqual(im.imag().avg(), -100) + + def test_histfind(self): + im = Vips.Image.black(50, 100) + test = im.insert(im + 100, 50, 0, expand = True) + + for fmt in all_formats: + hist = test.cast(fmt).hist_find() + self.assertAlmostEqualObjects(hist.getpoint(0,0), [5000]) + self.assertAlmostEqualObjects(hist.getpoint(100,0), [5000]) + self.assertAlmostEqualObjects(hist.getpoint(12,0), [0]) if __name__ == '__main__': unittest.main() diff --git a/python/vips8/vips.py b/python/vips8/vips.py index b64dc297..b1b8de4e 100644 --- a/python/vips8/vips.py +++ b/python/vips8/vips.py @@ -255,10 +255,6 @@ def vips_image_new_from_array(cls, array, scale = 1, offset = 0): return image -# this is a class method -def vips_black(cls, width, height, **kwargs): - return _call_base("black", [width, height], kwargs) - def vips_image_getattr(self, name): logging.debug('Image.__getattr__ %s' % name) @@ -403,6 +399,21 @@ def vips_abs(self): def vips_invert(self): return self ^ -1 +def vips_real(self): + return self.complexget(Vips.OperationComplexget.REAL) + +def vips_imag(self): + return self.complexget(Vips.OperationComplexget.IMAG) + +def vips_polar(self): + return self.complex(Vips.OperationComplex.POLAR) + +def vips_rect(self): + return self.complex(Vips.OperationComplex.RECT) + +def vips_conj(self): + return self.complex(Vips.OperationComplex.CONJ) + # paste our methods into Vips.Image # class methods @@ -410,9 +421,6 @@ setattr(Vips.Image, 'new_from_file', classmethod(vips_image_new_from_file)) setattr(Vips.Image, 'new_from_buffer', classmethod(vips_image_new_from_buffer)) setattr(Vips.Image, 'new_from_array', classmethod(vips_image_new_from_array)) -# yuk, we should run these via a metaclass somehow -#setattr(Vips.Image, 'black', classmethod(vips_black)) - # Search for all VipsOperation which don't have an input image object ... these # become class methods @@ -459,6 +467,11 @@ Vips.Image.write_to_buffer = vips_image_write_to_buffer # a few useful things Vips.Image.floor = vips_floor Vips.Image.bandsplit = vips_bandsplit +Vips.Image.real = vips_real +Vips.Image.imag = vips_imag +Vips.Image.polar = vips_polar +Vips.Image.rect = vips_rect +Vips.Image.conj = vips_conj # operator overloads Vips.Image.__getattr__ = vips_image_getattr