summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2018-07-27 12:55:36 +0200
committerMichele Simionato <michele.simionato@gmail.com>2018-07-27 12:55:36 +0200
commiteb890d98739196b83f1ecb5cb7bcfe9739a9502c (patch)
treed2862c1ef8645eb5cf7ffb150bf8d8a21ed52023
parentbbac0b4d046604ae5d17ed1b05bd0b01367d3be5 (diff)
downloadpython-decorator-git-eb890d98739196b83f1ecb5cb7bcfe9739a9502c.tar.gz
Added the path to the decorator module in the virtual file path
-rw-r--r--setup.py2
-rw-r--r--src/decorator.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 5890f4b..2f07200 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
from setuptools import setup
-dic = {}
+dic = dict(__file__=None)
exec(open('src/decorator.py').read(), dic)
VERSION = dic['__version__']
diff --git a/src/decorator.py b/src/decorator.py
index 44303ee..dceca03 100644
--- a/src/decorator.py
+++ b/src/decorator.py
@@ -173,7 +173,8 @@ class FunctionMaker(object):
# Ensure each generated function has a unique filename for profilers
# (such as cProfile) that depend on the tuple of (<filename>,
# <definition line>, <function name>) being unique.
- filename = '<decorator-gen-%d>' % (next(self._compile_count),)
+ filename = '<%s:decorator-gen-%d>' % (
+ __file__, next(self._compile_count))
try:
code = compile(src, filename, 'single')
exec(code, evaldict)