Skip to content

Commit 7c34451

Browse files
committed
python wrapper: fix __file__ in python3.9
Bug: https://bugs.gentoo.org/794739 Signed-off-by: Michał Górny <mgorny@gentoo.org>
1 parent a8c48d0 commit 7c34451

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/python-exec.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!@bindir@/python-exec2c@exeext@
22
# vim:fileencoding=utf-8:ft=python
3-
# (c) 2012-2016 Michał Górny
3+
# (c) 2012-2021 Michał Górny
44
# Released under the terms of the 2-clause BSD license.
55
#
66
# This is not the script you are looking for. This is just a wrapper.
@@ -81,6 +81,9 @@ while data is None:
8181
raise
8282

8383
sys.argv[0] = target
84+
# in python3.9+, __file__ paths are absolute
85+
if sys.version_info >= (3, 9):
86+
target = os.path.abspath(target)
8487
new_globals['__file__'] = target
8588

8689
exec(data, new_globals)

0 commit comments

Comments
 (0)