This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] test: ensure certain types exposed to python are not instancable


That syntax was added in Python 2.6.  If you want to handle older Pythons, you need to use plain "except $exception" and extract the value ("e") via "e = sys.exc_info ()[1]".  That workaround shows up in a number of other spots in the testsuite.

	paul

On Oct 10, 2013, at 3:14 PM, Tom Tromey <tromey@redhat.com> wrote:

>>>>>> "Sanimir" == Sanimir Agovic <sanimir.agovic@intel.com> writes:
> 
> Sanimir> The proc gdb_py_test_exception executes a piece of python code and
> Sanimir> expects an exception of type EXCEPTION to be raised by the code with
> Sanimir> an optional MESSAGE for fine grained filtering.
> 
> FWIW I generally put the test cases in the same patch as the
> modification; same with the docs.  That's because they are a conceptual
> unit.
> 
> It looks good, however --
> 
> Sanimir> +    gdb_py_test_multiple "$stmt throws $exception" \
> Sanimir> +      "python" "" \
> Sanimir> +      "try:" "" \
> Sanimir> +      "   $stmt" "" \
> Sanimir> +      "except $exception as e:" "" \
> 
> ... there's one version of Python we support that doesn't have this
> syntax.  I forget which one, I know Phil remembers though.
> 
> Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]