Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37507318
en ru br
ALT Linux repositórios
S:4.1.1-alt7
5.0: 1.3.36-alt2
4.1: 1.3.31-alt2
4.0: 1.3.31-alt1
3.0: 1.3.24-alt2

Group :: Desenvolvimento/C
RPM: swig

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: fix_import_package.patch
Download


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);
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009