Skip to content

Commit

Permalink
Simplify code by removing exec()
Browse files Browse the repository at this point in the history
Supercedes #788
  • Loading branch information
lukebakken committed Jul 26, 2017
1 parent 5fd432f commit 49869a5
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions pika/adapters/select_connection.py
Expand Up @@ -245,18 +245,7 @@ def poll(self):
self._poller.poll()


# Define a base class for deriving abstract base classes for compatibility
# between python 2 and 3 (metaclass syntax changed in Python 3). Ideally, would
# use `@six.add_metaclass` or `six.with_metaclass`, but pika traditionally has
# resisted external dependencies in its core code.
if pika.compat.PY2:
class _AbstractBase(object): # pylint: disable=R0903
"""PY2 Abstract base for _PollerBase class"""
__metaclass__ = abc.ABCMeta
else:
# NOTE: Wrapping in exec, because
# `class _AbstractBase(metaclass=abc.ABCMeta)` fails to load on python 2.
exec('class _AbstractBase(metaclass=abc.ABCMeta): pass') # pylint: disable=W0122
_AbstractBase = abc.ABCMeta('_AbstractBase', (object,), {})


class _PollerBase(_AbstractBase): # pylint: disable=R0902
Expand Down

0 comments on commit 49869a5

Please sign in to comment.