Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37737453
en ru br
Репозитории ALT
S:4.1.1-alt7
5.1: 1.3.39-alt1
4.1: 1.3.31-alt2
4.0: 1.3.31-alt1
3.0: 1.3.24-alt2
www.altlinux.org/Changes

Группа :: Разработка/C
Пакет: swig

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: fix_import_package.patch
Скачать


diff --git a/swig/Source/Modules/python.cxx b/swig/Source/Modules/python.cxx
index a6801fc..7aa08ba 100644
--- a/swig/Source/Modules/python.cxx
+++ b/swig/Source/Modules/python.cxx
@@ -846,7 +846,8 @@ public:
       Printv(default_import_code, "if _swig_python_version_info >= (2, 7, 0):\n", NULL);
       Printv(default_import_code, tab4, "def swig_import_helper():\n", NULL);
       Printv(default_import_code, tab8, "import importlib\n", NULL);
-      Printv(default_import_code, tab8, "pkg = __name__.rpartition('.')[0]\n", NULL);
+      Printv(default_import_code, tab8, "pkg_parts = __name__.rpartition('.')\n", NULL);
+      Printv(default_import_code, tab8, "pkg = pkg_parts[0] if pkg_parts[1] == '.' else pkg_parts[2]\n", NULL);
       Printf(default_import_code, tab8 "mname = '.'.join((pkg, '%s')).lstrip('.')\n", module);
       Printv(default_import_code, tab8, "try:\n", NULL);
       Printv(default_import_code, tab8, tab4, "return importlib.import_module(mname)\n", NULL);
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin