Skip to content

Commit

Permalink
Support for Python 3.8
Browse files Browse the repository at this point in the history
- Enables Travis for 3.8
- Fixes namedtuple test for 3.8

COPYBARA_INTEGRATE_REVIEW=google#263 from uburuntu:master efaf65f
PiperOrigin-RevId: 316134191
Change-Id: I5e3ef20b488fa917b81525d5936a8e147b0458e1
  • Loading branch information
uburuntu authored and copybara-github committed Jun 12, 2020
1 parent fb7ee3a commit 457b156
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
11 changes: 3 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
# Workaround for testing Python 3.7:
# https://github.com/travis-ci/travis-ci/issues/9815
matrix:
include:
- python: 3.7
dist: xenial
sudo: yes
- "3.7"
- "3.8"

before_install:
- pip install --upgrade setuptools pip
- pip install --upgrade pylint pytest pytest-pylint pytest-runner
Expand Down
14 changes: 10 additions & 4 deletions fire/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,16 @@ def MemberVisible(component, name, member, class_attrs=None, verbose=False):
if class_attrs is None:
class_attrs = inspectutils.GetClassAttrsDict(class_attrs) or {}
class_attr = class_attrs.get(name)
if class_attr and class_attr.kind in ('method', 'property'):
# methods and properties should be accessed on instantiated objects,
# not uninstantiated classes.
return False
if class_attr:
# Methods and properties should only be accessible on instantiated
# objects, not on uninstantiated classes.
if class_attr.kind in ('method', 'property'):
return False
# Backward compatibility notes: Before Python 3.8, namedtuple attributes
# were properties. In Python 3.8, they have type tuplegetter.
tuplegetter = getattr(collections, '_tuplegetter', type(None))
if isinstance(class_attr.object, tuplegetter):
return False
if (six.PY2 and inspect.isfunction(component)
and name in ('func_closure', 'func_code', 'func_defaults',
'func_dict', 'func_doc', 'func_globals', 'func_name')):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',

'Operating System :: OS Independent',
'Operating System :: POSIX',
Expand Down

0 comments on commit 457b156

Please sign in to comment.