Issue245

Title TypeError: cannot concatenate 'str' and 'tuple' objects
Priority bug Status resolved
Superseder Nosy List kayhayen, marc.jofre
Assigned To kayhayen Keywords compiler_crash, develop, optimization, wrong_execution

Created on 2015-09-12.05:53:11 by marc.jofre, last changed by marc.jofre.

Messages
msg1551 (view) Author: marc.jofre Date: 2015-09-15.04:21:11
Hi Kay,

In nuitka version 0.5.15.pre4 it is resolved. I have checked it.

Best,

Marc
msg1541 (view) Author: kayhayen Date: 2015-09-14.07:52:13
Hello Marc,

I had been interrupted finding that the code, while it applies, does not work 
on master, and so I had to redo these releases. So it's only in develop now, 
which I just pushed, packages are just building. 

BTW: Avoid factory for a while. It has got other fixes that reveal more need 
for fixes.

Sorry for the confusion,
Kay
msg1540 (view) Author: marc.jofre Date: 2015-09-14.04:55:24
Hi Kay,

I updated to the latest hotfix. The windows command line dump:

tiprocessing' as relative or absolute import.
Problem with statement at  
D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site
-packages\setuptools\extension.py:22:
Problem with statement at  
D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site
-packages\setuptools\extension.py:20:
Problem with statement at  
D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site
-packages\setuptools\extension.py:15:
Problem with statement at  
D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site
-packages\setuptools\extension.py:15:
Traceback (most recent call last):
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Scripts\nuitka", line  
181,
  in <module>
     MainControl.main()
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\M
ainControl.py", line 707, in main
     filename = filename
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\M
ainControl.py", line 106, in createNodeTree
     Optimization.optimize()
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\Optimization.py", line 310, in optimize
     changed = optimizePythonModule(current_module)
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\Optimization.py", line 95, in optimizePythonModule
     module.computeModule()
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\ModuleNodes.py", line 402, in computeModule
     constraint_collection = self.constraint_collection
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 175, in computeStatementsSequence
     constraint_collection
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\FrameNodes.py", line 191, in computeStatementsSequence
     statement = statement
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 565, in onStatement
     statement.computeStatement(self)
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\AssignNodes.py", line 118, in computeStatement
     constraint_collection.onExpression(self.getAssignSource())
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 523, in onExpression
     constraint_collection = self
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\NodeBases.py", line 1154, in computeExpressionRaw
     expression = sub_expression
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 523, in onExpression
     constraint_collection = self
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\FunctionNodes.py", line 784, in computeExpressionRaw
     constraint_collection = function_body.constraint_collection
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 179, in computeStatementsSequence
     statement = statement
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 565, in onStatement
     statement.computeStatement(self)
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\TryNodes.py", line 128, in computeStatement
     constraint_collection = constraint_collection
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 175, in computeStatementsSequence
     constraint_collection
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\FrameNodes.py", line 191, in computeStatementsSequence
     statement = statement
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 565, in onStatement
     statement.computeStatement(self)
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\TryNodes.py", line 128, in computeStatement
     constraint_collection = constraint_collection
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 179, in computeStatementsSequence
     statement = statement
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 565, in onStatement
     statement.computeStatement(self)
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 248, in computeStatement
     expression = self.getExpression()
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 523, in onExpression
     constraint_collection = self
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\NodeBases.py", line 1154, in computeExpressionRaw
     expression = sub_expression
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 523, in onExpression
     constraint_collection = self
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\NodeBases.py", line 1175, in computeExpressionRaw
     constraint_collection = constraint_collection
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\ImportNodes.py", line 220, in computeExpression
     constraint_collection = constraint_collection
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\ImportNodes.py", line 175, in _attemptRecursion
     warn           = True
   File  
"D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\i
mporting\Importing.py", line 214, in findModule
     full_name = normalizePackageName(parent_package + '.' + module_name)
TypeError: cannot concatenate 'str' and 'tuple' objects

Quoting "Kay Hayen (via Issue Tracker)" <issue_tracker@nuitka.net>:

> Kay Hayen <kay.hayen@gmail.com> added the comment:
>
> Since it applied cleanly, I made it part of the hotfix 0.5.14.3  
> instead, even if
> not needed it's still a bug fix, and that one is due.
>
> _______________________________________________
> Nuitka issue tracker <issue_tracker@nuitka.net>
> <http://bugs.nuitka.net/issue245>
> _______________________________________________

-- 
Marc Jofre
Nanophotonics-Optoelectronics
ICFO-The Institute of Photonic Sciences
Mediterranean Technology Park
Av. Carl Friedrich Gauss, 3
08860 Castelldefels (Barcelona), Spain
Telephone: +34 935542230
Fax: +34 935534000
E-mail: marc.jofre@icfo.es
Internet: www.icfo.es
msg1538 (view) Author: kayhayen Date: 2015-09-13.10:25:35
Since it applied cleanly, I made it part of the hotfix 0.5.14.3 instead, even if 
not needed it's still a bug fix, and that one is due.
msg1530 (view) Author: kayhayen Date: 2015-09-12.08:21:33
Forget about "hotfix", the issue is dependent on value propagation to be done, 
otherwise the optimization sees no constant tuple, but just a variable 
reference, and let Python's "__import__" figure it out. The bug of course is 
real, but there is very little code like this, I suppose:

__import__(("something",))

So that would be over the edge to backport. Instead find the fix on factory 
please.

Yours,
Kay
msg1529 (view) Author: kayhayen Date: 2015-09-12.07:56:33
Yup, checking __import__ source code, and experimenting, that is never going to work at all.

This whole code:

def _have_cython():
    """
    Return True if Cython can be imported.
    """
    cython_impl = 'Cython.Distutils.build_ext',
    try:
        # from (cython_impl) import build_ext
        __import__(cython_impl, fromlist=['build_ext']).build_ext
        return True
    except Exception:
        pass
    return False

Is just an elaborate way of a function that always returns False. For Nuitka it will
soon be possible to make that implicit raise and eliminate the code with a warning,
that we better suppress though, as it's kind of standard library-ish code.

Thanks for the report, there will be a hotfix for this later today.

Yours,
Kay
msg1528 (view) Author: kayhayen Date: 2015-09-12.07:49:05
The Python documentation says nothing about non-string arguments there, it 
most likely is some kind of typo if you ask me. But then I have no clue, why a 
variable is used in the first place there.

Yours,
Kay
msg1527 (view) Author: kayhayen Date: 2015-09-12.07:46:06
Seems the error is this (condensed)

    cython_impl = 'Cython.Distutils.build_ext',
    __import__(cython_impl, fromlist=['build_ext']).build_ext

The first line creates a tuple, rather than a string. I need to check out, what this
does for regurlar __import__ built-in, the optimization is making an import node with
a tuple out of, something which cannot exist.

Yours,
Kay
msg1525 (view) Author: marc.jofre Date: 2015-09-12.05:53:11
Hi all,

nuitka version 5.15pr3. The windows command line prompt dump is:


Problem with statement at D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site
-packages\setuptools\extension.py:22:
Problem with statement at D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site
-packages\setuptools\extension.py:20:
Problem with statement at D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site
-packages\setuptools\extension.py:15:
Problem with statement at D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site
-packages\setuptools\extension.py:15:
Traceback (most recent call last):
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Scripts\nuitka", line 181,
 in <module>
    MainControl.main()
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\M
ainControl.py", line 707, in main
    filename = filename
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\M
ainControl.py", line 106, in createNodeTree
    Optimization.optimize()
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\Optimization.py", line 310, in optimize
    changed = optimizePythonModule(current_module)
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\Optimization.py", line 95, in optimizePythonModule
    module.computeModule()
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\ModuleNodes.py", line 402, in computeModule
    constraint_collection = self.constraint_collection
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 175, in computeStatementsSequence
    constraint_collection
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\FrameNodes.py", line 191, in computeStatementsSequence
    statement = statement
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 565, in onStatement
    statement.computeStatement(self)
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\AssignNodes.py", line 118, in computeStatement
    constraint_collection.onExpression(self.getAssignSource())
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 523, in onExpression
    constraint_collection = self
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\NodeBases.py", line 1154, in computeExpressionRaw
    expression = sub_expression
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 523, in onExpression
    constraint_collection = self
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\FunctionNodes.py", line 784, in computeExpressionRaw
    constraint_collection = function_body.constraint_collection
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 179, in computeStatementsSequence
    statement = statement
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 565, in onStatement
    statement.computeStatement(self)
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\TryNodes.py", line 128, in computeStatement
    constraint_collection = constraint_collection
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 175, in computeStatementsSequence
    constraint_collection
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\FrameNodes.py", line 191, in computeStatementsSequence
    statement = statement
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 565, in onStatement
    statement.computeStatement(self)
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\TryNodes.py", line 128, in computeStatement
    constraint_collection = constraint_collection
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 179, in computeStatementsSequence
    statement = statement
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 565, in onStatement
    statement.computeStatement(self)
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\StatementNodes.py", line 248, in computeStatement
    expression = self.getExpression()
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 523, in onExpression
    constraint_collection = self
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\NodeBases.py", line 1154, in computeExpressionRaw
    expression = sub_expression
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\o
ptimizations\TraceCollections.py", line 523, in onExpression
    constraint_collection = self
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\NodeBases.py", line 1175, in computeExpressionRaw
    constraint_collection = constraint_collection
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\ImportNodes.py", line 220, in computeExpression
    constraint_collection = constraint_collection
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\n
odes\ImportNodes.py", line 175, in _attemptRecursion
    warn           = True
  File "D:\WinPython-64bit-2.7.6.3\python-2.7.6.amd64\Lib\site-packages\nuitka\i
mporting\Importing.py", line 214, in findModule
    full_name = normalizePackageName(parent_package + '.' + module_name)
TypeError: cannot concatenate 'str' and 'tuple' objects
History
Date User Action Args
2015-09-15 04:21:11marc.jofresetstatus: chatting -> resolved
messages: + msg1551
2015-09-15 04:21:03marc.jofresetmessages: - msg1550
2015-09-15 04:20:51marc.jofresetmessages: + msg1550
2015-09-15 04:20:43marc.jofresetmessages: - msg1549
2015-09-15 04:20:27marc.jofresetstatus: resolved -> chatting
messages: + msg1549
2015-09-14 07:52:25kayhayensetstatus: chatting -> resolved
2015-09-14 07:52:13kayhayensetmessages: + msg1541
2015-09-14 04:55:24marc.jofresetstatus: resolved -> chatting
messages: + msg1540
2015-09-13 10:25:42kayhayensetstatus: testing -> resolved
2015-09-13 10:25:35kayhayensetmessages: + msg1538
2015-09-12 08:21:33kayhayensetstatus: chatting -> testing
messages: + msg1530
keyword: + develop
2015-09-12 07:56:34kayhayensetmessages: + msg1529
keyword: + compiler_crash, wrong_execution, optimization
2015-09-12 07:49:05kayhayensetassignedto: kayhayen
messages: + msg1528
nosy: + kayhayen
2015-09-12 07:46:06kayhayensetstatus: unread -> chatting
messages: + msg1527
2015-09-12 05:53:11marc.jofrecreate