Ticket #11486 (new defect)

Opened 2 years ago

gnuplot 4.0.0 from optional/experimental packages has invalid use of "with" keyword for Python 2.6

Reported by: ijstokes Owned by: tbd
Priority: major Milestone: sage-5.11
Component: packages: optional Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

Following

./sage -i gnuplot-4.0.0

Sage reports ipython errors on startup due to the presence of the "with" keyword on line 68 here:

sage-latest/local/lib/python2.6/site-packages/Gnuplot/PlotItems.py

I didn't try to interpret exactly what these were doing, but changing that region of code to:

    # For _option_list explanation, see docstring for PlotItem.
    _option_list = {
        'axes' : lambda self, axes: self.set_string_option(
            'axes', axes, None, 'axes %s'),
        'title' : lambda self, title: self.set_string_option(
            'title', title, 'notitle', 'title "%s"'),
        }

    # ISR: with is reserved word, at least from Python 2.6
    import sys
    if sys.version_info < (2, 6):
        _option_list['with'] = lambda self, wif: self.set_string_option(
            'with', wif, None, 'with %s')

Seems to have fixed it for me. No idea if it will break other things. Think the "wif" is only in the context of the lambda so it should be OK.

Note: See TracTickets for help on using tickets.