From 73c8e55ff7a177eb49d71946d3992df34f41b9b2 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Mon, 31 Aug 2015 19:02:15 +0100 Subject: [PATCH 1/3] Add job with 3.6 nightly This job is allowed to fail. Also move the --pre flag to this job --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8ce1e94a8cfb..f906a3952b8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,10 @@ matrix: - python: 2.7 env: BUILD_DOCS=true MOCK=mock - python: "3.5.0rc4" + - python: "nightly" env: PRE=--pre + allow_failures: + - python: "nightly" before_install: - source tools/travis_tools.sh From 54ddbe5f425d253040ad32b8c8b5e375bd5321b5 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 1 Sep 2015 18:26:05 +0100 Subject: [PATCH 2/3] Readd --pre to 3.5 Needed because the wheelhouse does not correctly handle missing versions --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f906a3952b8f..03c02e6c48bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,7 @@ matrix: - python: 2.7 env: BUILD_DOCS=true MOCK=mock - python: "3.5.0rc4" + env: PRE=--pre - python: "nightly" env: PRE=--pre allow_failures: From 22f532e5fbccc2767ca17b7471057559fdb32ed8 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 2 Sep 2015 18:50:43 +0100 Subject: [PATCH 3/3] Use getfullargspec on python3 Prefere this over getargspec which will be removed in 3.6. This is the least intrusive change however getfullargspec has been deprecated too. Post 2.0 we should rewrite the code to use signature instead --- boilerplate.py | 7 +++++-- lib/matplotlib/artist.py | 6 +++++- lib/matplotlib/patches.py | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/boilerplate.py b/boilerplate.py index 67fb7001146e..e2545d9e89a0 100644 --- a/boilerplate.py +++ b/boilerplate.py @@ -214,8 +214,11 @@ def format_value(value): has_data = 'data' in inspect.signature(base_func).parameters work_func = inspect.unwrap(base_func) - args, varargs, varkw, defaults = inspect.getargspec(work_func) - + if six.PY2: + args, varargs, varkw, defaults = inspect.getargspec(work_func) + else: + (args, varargs, varkw, defaults, kwonlyargs, kwonlydefs, + annotations) = inspect.getfullargspec(work_func) args.pop(0) # remove 'self' argument if defaults is None: defaults = () diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index 2cfa5738cb1b..a4614f214299 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -1110,7 +1110,11 @@ def _get_setters_and_targets(self): o = getattr(self.o, name) if not six.callable(o): continue - if len(inspect.getargspec(o)[0]) < 2: + if six.PY2: + nargs = len(inspect.getargspec(o)[0]) + else: + nargs = len(inspect.getfullargspec(o)[0]) + if nargs < 2: continue func = o if self.is_alias(func): diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index c25a2bf8fb7f..e4f1c750df54 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -1781,7 +1781,11 @@ def _pprint_styles(_styles): _table = [["Class", "Name", "Attrs"]] for name, cls in sorted(_styles.items()): - args, varargs, varkw, defaults = inspect.getargspec(cls.__init__) + if six.PY2: + args, varargs, varkw, defaults = inspect.getargspec(cls.__init__) + else: + (args, varargs, varkw, defaults, kwonlyargs, kwonlydefs, + annotations) = inspect.getfullargspec(cls.__init__) if defaults: args = [(argname, argdefault) for argname, argdefault in zip(args[1:], defaults)]