Repository: spyder-ide/spyder

Issue:
Profiler crash in Spyder 4.1.0
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [x] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [x] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [x] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [x] Reset preferences with ``spyder --reset``
    * [x] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [x] Tried the other applicable steps from the Troubleshooting Guide
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

The profiler doesn't works when `input()` function is in the profiled
code. The profiler crashes when "output" button (in Profiler Panel) is clicked.

### What steps reproduce the problem?

1. Run Navigator, run Spyder 4.1.0
2. Write this sample program::


```
    def sum_of_harmonic_series(n):
        s = 0
        for k in range(n, 0, -1):
            s += 1 / k
        return s

    if __name__ == '__main__':
        print('Compute')
        N = int(input("n: "))
        print('sum = ', sum_of_harmonic_series(N))
```

3. Run program - no problem here - normal end. Ok.

4. Run profiler to profile the sample program - it doesn't work at all - profiler hangs.

5. Close Spyder. Reopen Spyder.

6. Replace `int(input("n: "))` by hardcoded 10000, i.e. the test program should be::

```
    def sum_of_harmonic_series(n):
        s = 0
        for k in range(n, 0, -1):
            s += 1 / k
        return s

    if __name__ == '__main__':
        print('Compute')
        N = 10000
        print('sum = ', sum_of_harmonic_series(N))
```

7. Run profiler - profiler works, results are displayed  - Ok.

8. Click the "output" button in the profiler panel - kaboom! - "Spyder has encountered an internal problem!" 

### What is the expected output? What do you see instead?

### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

 Traceback (most recent call last):
  File "C:\Users\Slawek\anaconda3\lib\site-packages\spyder\plugins\profiler\widgets\profilergui.py", line 235, in show_log
    readonly=True, size=(700, 500), parent=self).exec_()
TypeError: __init__() got an unexpected keyword argument 'size'
Traceback (most recent call last):
  File "C:\Users\Slawek\anaconda3\lib\site-packages\spyder\plugins\profiler\widgets\profilergui.py", line 235, in show_log
    readonly=True, size=(700, 500), parent=self).exec_()
TypeError: __init__() got an unexpected keyword argument 'size'


```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.1.0
* Python version: 3.7.6 64-bit
* Qt version: 5.9.6
* PyQt version: 5.9.2
* Operating System name/version: MS Windows 10

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```

# Mandatory:
atomicwrites >=1.2.0           :  1.3.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.3.0 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.13.0 (OK)
jedi =0.14.1                   :  0.14.1 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
paramiko >=2.4.0               :  2.7.1 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.4.4 (OK)
pyls >=0.31.2;<0.32.0          :  0.31.8 (OK)
qdarkstyle >=2.8               :  2.8 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.1 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.3 (OK)
sphinx >=0.6.6                 :  2.4.0 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  0.29.15 (OK)
matplotlib >=2.0.0             :  3.1.3 (OK)
numpy >=1.7                    :  1.18.1 (OK)
pandas >=0.13.1                :  1.0.2 (OK)
scipy >=0.17.0                 :  1.4.1 (OK)
sympy >=0.7.3                  :  1.5.1 (OK)

```



Discussion:
Thanks for reporting. We'll try to fix this in our next release.
@steff456, please take a look at this one.

Resolving patch:
diff --git a/spyder/plugins/profiler/widgets/profilergui.py b/spyder/plugins/profiler/widgets/profilergui.py
--- a/spyder/plugins/profiler/widgets/profilergui.py
+++ b/spyder/plugins/profiler/widgets/profilergui.py
@@ -231,13 +231,18 @@ def select_file(self):
 
     def show_log(self):
         if self.output:
-            TextEditor(self.output, title=_("Profiler output"),
-                       readonly=True, size=(700, 500), parent=self).exec_()
+            output_dialog = TextEditor(self.output, title=_("Profiler output"),
+                                       readonly=True, parent=self)
+            output_dialog.resize(700, 500)
+            output_dialog.exec_()
 
     def show_errorlog(self):
         if self.error_output:
-            TextEditor(self.error_output, title=_("Profiler output"),
-                       readonly=True, size=(700, 500), parent=self).exec_()
+            output_dialog = TextEditor(self.error_output,
+                                       title=_("Profiler output"),
+                                       readonly=True, parent=self)
+            output_dialog.resize(700, 500)
+            output_dialog.exec_()
 
     def start(self, wdir=None, args=None, pythonpath=None):
         filename = to_text_string(self.filecombo.currentText())


Test patch: