summaryrefslogtreecommitdiff
path: root/Lib/asyncio/events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-07-25 02:23:21 +0200
committerVictor Stinner <victor.stinner@gmail.com>2015-07-25 02:23:21 +0200
commit71080fc3518e2d3555f555340c3e93f3b108a5b8 (patch)
tree5125e65a9293873cf5d307dd5de1d093de74ea8a /Lib/asyncio/events.py
parentf05b79dbd286f6723ee717c31766c97551e4e34d (diff)
downloadcpython-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.py7
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