diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-12-25 15:21:24 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-08 17:14:56 +0100 |
commit | e034d5085d26f6703cf907caf78292d9a7861aa2 (patch) | |
tree | f18cecbf744a6399524f0c208614cc4e8f677399 | |
parent | f3da098d40bb7f8103f6d49d73115dd8d92e7d23 (diff) |
signature: Fix infinite loop changing up directories
Break out of the loop when dirname() returns the identical string.
Fixes: PYSIDE-1460
Change-Id: I31a53946bb302758acb196f47a9ad605edfdd667
Reviewed-by: Christian Tismer <tismer@stackless.com>
(cherry picked from commit 131a1c17eed13171bf09ba42b2205760580e4f24)
-rw-r--r-- | sources/shiboken2/libshiboken/embed/signature_bootstrap.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/shiboken2/libshiboken/embed/signature_bootstrap.py b/sources/shiboken2/libshiboken/embed/signature_bootstrap.py index b7d9d2793..dd8df2b63 100644 --- a/sources/shiboken2/libshiboken/embed/signature_bootstrap.py +++ b/sources/shiboken2/libshiboken/embed/signature_bootstrap.py @@ -110,8 +110,11 @@ def bootstrap(): rp = os.path.realpath(os.path.dirname(root.__file__)) # This can be the shiboken2 directory or the binary module, so search. look_for = os.path.join("files.dir", "shibokensupport", "signature", "loader.py") - while len(rp) > 3 and not os.path.exists(os.path.join(rp, look_for)): - rp = os.path.abspath(os.path.join(rp, "..")) + while not os.path.exists(os.path.join(rp, look_for)): + dir = os.path.dirname(rp) + if dir == rp: # Hit root, '/', 'C:\', '\\server\share' + break + rp = dir # Here we decide if we work embedded or not. embedding_var = "pyside_uses_embedding" |