diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-07-25 02:23:21 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-07-25 02:23:21 +0200 |
commit | 71080fc3518e2d3555f555340c3e93f3b108a5b8 (patch) | |
tree | 5125e65a9293873cf5d307dd5de1d093de74ea8a /Lib/asyncio/events.py | |
parent | f05b79dbd286f6723ee717c31766c97551e4e34d (diff) | |
download | cpython-git-71080fc3518e2d3555f555340c3e93f3b108a5b8.tar.gz |
asyncio: Add asyncio.compat module
Move compatibility helpers for the different Python versions to a new
asyncio.compat module.
Diffstat (limited to 'Lib/asyncio/events.py')
-rw-r--r-- | Lib/asyncio/events.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index 496075bacf..d5f0d45195 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -17,12 +17,11 @@ import sys import threading import traceback - -_PY34 = sys.version_info >= (3, 4) +from asyncio import compat def _get_function_source(func): - if _PY34: + if compat.PY34: func = inspect.unwrap(func) elif hasattr(func, '__wrapped__'): func = func.__wrapped__ @@ -31,7 +30,7 @@ def _get_function_source(func): return (code.co_filename, code.co_firstlineno) if isinstance(func, functools.partial): return _get_function_source(func.func) - if _PY34 and isinstance(func, functools.partialmethod): + if compat.PY34 and isinstance(func, functools.partialmethod): return _get_function_source(func.func) return None |