[issue34055] IDLE: erroneous 'smart' indents in shell

2019-01-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

PR 11307 was moved to #35610.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2019-01-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10543

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2019-01-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

On my Macbook with Mohave with installed python.org 3.7.2, compiled against tk 
8.6.8, the startup header is
Python 3.7.2 (v3.7.2.9a3ffc0492, Dec 24 ...) [Clang 6.0 .. on Darwin].

Your header is quite different (repository?, tk version?) but the version is 
the exact same: '3.7.2'.  This should mean that it is a compilation of released 
3.7.2 and does not have any post-3.7.2 patches, such as the fix here.  If it 
did, the version should be '3.7.2+', as it is for my 3.7 compiled today.

Since the problem resulting from a missing closers was fixed on Windows and 
Ubuntu by the post 3.7.2 patch, I will presume it is fixed on Mac also until 
presented with clear evidence otherwise.

Tal, does Grant's problem with compiling on Mac look familiar to you?

--
nosy: +taleinat
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2019-01-02 Thread Grant Jenks


Grant Jenks  added the comment:

This issue was closed but I still see the problem in 3.7.2. Here's a snippet 
with line numbers from IDLE:

01 Python 3.7.2 (default, Dec 30 2018, 08:59:00) 
02 [Clang 9.1.0 (clang-902.0.39.2)] on darwin
03 Type "help", "copyright", "credits" or "license()" for more information.
04 >>> 1 + 2
05 3
06 >>> print('Hello')
07 Hello
08 >>> d = {1: 'uno', 2: 'dos', 3: 'tres}
09   
10 SyntaxError: EOL while scanning string literal
11 >>> 1 + 2
12   
13 3
14 >>> 

Notice that IDLE is inserting an extra blank line at (12) above.

And here's a snippet with line numbers from the Python shell:

01 Python 3.7.2 (default, Dec 30 2018, 08:59:00) 
02 [Clang 9.1.0 (clang-902.0.39.2)] on darwin
03 Type "help", "copyright", "credits" or "license" for more information.
04 >>> 1 + 2
05 3
06 >>> print('Hello')
07 Hello
08 >>> d = {1: 'uno', 2: 'dos', 3: 'tres}
09   File "", line 1
10 d = {1: 'uno', 2: 'dos', 3: 'tres}
11  ^
12 SyntaxError: EOL while scanning string literal
13 >>> 1 + 2
14 3
15 >>> 

Between lines (13) and (14) there is no extra blank line.

I'm sorry if my initial post was unclear. But the extra blank line is the bug 
I'm describing. I don't think there should be an extra blank line between (11) 
and (13) in the IDLE shell. This blank line persists for every input, even 
after restarts.

I'm on macOS.

I would be interested in debugging the issue locally but I ran into a couple 
issues trying to do so. When I check out the CPython sources and build the 
python.exe executable, I get this error when trying to execute IDLE:

$ ./python.exe -m pdb -m idlelib.idle
> /Users/grantj/repos/cpython/Lib/idlelib/idle.py(1)()
-> import os.path
(Pdb) c
Traceback (most recent call last):
  File "/Users/grantj/repos/cpython/Lib/pdb.py", line 1695, in main
pdb._runmodule(mainpyfile)
  File "/Users/grantj/repos/cpython/Lib/pdb.py", line 1540, in _runmodule
self.run(code)
  File "/Users/grantj/repos/cpython/Lib/bdb.py", line 585, in run
exec(cmd, globals, locals)
  File "/Users/grantj/repos/cpython/Lib/idlelib/idle.py", line 1, in 
import os.path
  File "/Users/grantj/repos/cpython/Lib/idlelib/pyshell.py", line 1507, in main
macosx.setupApp(root, flist)
  File "/Users/grantj/repos/cpython/Lib/idlelib/macosx.py", line 280, in 
setupApp
overrideRootMenu(root, flist)
  File "/Users/grantj/repos/cpython/Lib/idlelib/macosx.py", line 181, in 
overrideRootMenu
del mainmenu.menudefs[-2][1][0]
IndexError: list assignment index out of range

If I comment out line 181 in /Users/grantj/repos/cpython/Lib/idlelib/macosx.py 
then I can get IDLE to start. But it will later crash trying to display the 
first tooltip:

$ ./python.exe -m pdb -m idlelib.idle
> /Users/grantj/repos/cpython/Lib/idlelib/idle.py(1)()
-> import os.path
(Pdb) c
2019-01-02 15:52:57.582 python.exe[23803:6374992] *** Assertion failure in 
-[_NSCGSWindow setFrame:], 
/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.60.100/CGS.subproj/NSCGSWindow.m:1002
2019-01-02 15:52:57.588 python.exe[23803:6374992] *** Terminating app due to 
uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid 
parameter not satisfying: CGRectContainsRect(CGRectMake((CGFloat)INT_MIN, 
(CGFloat)INT_MIN, (CGFloat)INT_MAX - (CGFloat)INT_MIN, (CGFloat)INT_MAX - 
(CGFloat)INT_MIN), frame)'
*** First throw call stack:
(
0   CoreFoundation  0x7fff48fa923b 
__exceptionPreprocess + 171
1   libobjc.A.dylib 0x7fff7023ac76 
objc_exception_throw + 48
2   CoreFoundation  0x7fff48faefd2 
+[NSException raise:format:arguments:] + 98
3   Foundation  0x7fff4b0d9150 
-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] 
+ 193
4   AppKit  0x7fff465d6f50 
-[_NSCGSWindow setFrame:] + 475
5   AppKit  0x7fff4668eb07 
_NSCreateWindowWithOpaqueShape2 + 248
6   AppKit  0x7fff4668d763 -[NSWindow 
_commonAwake] + 1057
7   AppKit  0x7fff46d9bbe7 
-[NSWindow(NSWindow_Carbon) 
windowRefWithCompositedAttribute:andFrameworkScaledAttribute:] + 139
8   Tk  0x0001061f9ad5 XMapWindow + 
239
9   Tk  0x000106166dbf Tk_MapWindow 
+ 89
10  Tk  0x00010616fcc5 MapFrame + 62
11  Tcl 0x0001060c05cd 
TclServiceIdle + 76
12  Tcl 0x0001060a4a96 
Tcl_DoOneEvent + 329
13  Tk  0x000106145f7d 
Tk_UpdateObjCmd + 172
14  Tcl 0x00010603ed6f 
TclEvalObjvInternal + 773
15  Tcl 

[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I 'moved' pr-11307 to #35610 by changing the title.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Even before this fix, in 3.7.2, I no longer see the extra blank lines I 
reported in msg321135 either on Windows or macOS.  I did still see the 
persistent and expanding indents reported in the opening post.  I believe that 
this is what Raymond also referred to.  The one I could reproduce are now gone. 
 Hence, I close this.

Remaining newline and indent issues should be handled in other issues.

* I intend to review the initial PR for #32989 soon.  I don't know what its 
effect might be on the user-visible result.

* Too short indents for open fences needs a new issue.

* Blank line before SyntaxError: interactive python does this.

>>> d={a:'a}
  File "", line 1
d={a:'a}
   ^
SyntaxError: EOL while scanning string literal
>>>

The ^ line is nearly blank.  IDLE omits the line echo and ^ and adds a red 
highlight instead ... + an invisible indent on the next line (now too short). 
(It also color-codes the error message.)

>>> d={a:'a}<---red highlight to end of line...
   
SyntaxError: EOL while scanning string literal
>>>

Checking syntax first and skipping indent on error would give the following.  I 
don't know how easy this would be.

>>> d={a:'a}<---red highlight to end of line...
SyntaxError: EOL while scanning string literal
>>>

--
dependencies:  -IDLE: Fix pyparse.find_good_parse_start and its bad editor call
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10643

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10644

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread miss-islington


miss-islington  added the comment:


New changeset 95dc4577c3a1bb12978de5234aaf07839f4d7844 by Miss Islington (bot) 
in branch '3.7':
bpo-34055: Revert deletion of line in IDLE's PyShell (GH-11346)
https://github.com/python/cpython/commit/95dc4577c3a1bb12978de5234aaf07839f4d7844


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10642, 10643
stage: test needed -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10642, 10643, 10644
stage: test needed -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10642
stage: test needed -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 4bc246786f003cdf1fffb3403b4cd92fc42ba9ef by Terry Jan Reedy in 
branch 'master':
bpo-34055: Revert deletion of line in IDLE's PyShell (#11346)
https://github.com/python/cpython/commit/4bc246786f003cdf1fffb3403b4cd92fc42ba9ef


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10641

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I changed the title back to the symptom description, rather than the wrong fix. 
 As Cheryl noted, the cause of the specific regression is the erroneous 
deletion of one line in pyshell.PyShell.  The simplest fix is to put is back.

Globally replacing context_use_ps1 is a different issue, and there is more than 
one possibility.  I will open a new issue and move PR 11307 there.

The reversion also reverts the 'fixes' that came with the error.  Fixing the 
shell branch, now that is is used, will be a different issue.
>>> d = {1:3,
 # correct indent, 3.7

>>> d = {1:3,
 # indent not accounting for prompt, after reversion

--
stage: patch review -> test needed
title: IDLE Shell: check syntax before smart indent -> IDLE: erroneous 'smart' 
indents in shell

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-12-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10640

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-07-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Of late, I've also encountered two recurring problems along these lines.  At 
some point in the IDLE session, the auto-indents become large and this survives 
a restart-shell.   Another problem is that an extra \n is emitted after every 
result which gives an odd double-spaced effect.  

When added to other existing bugs, this has greatly impaired the usability of 
IDLE for teaching (the tool tips no longer display on the newest mac builds and 
periodically the mouse pointer is mistargeted by 1/4 of the screen until the 
screen is resized, and periodically I encounter cases where pressing any key in 
the interactive session results in pasting the current contents of the keyboard 
on the current entry line).

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-07-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

def funcname(param = 'somestring)
 # Indent for next param.

is another situation where \n is treating as closing '.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34055] IDLE: erroneous 'smart' indents in shell

2018-07-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The SyntaxError is not relevant.  Interactive CPython:

>>> d=[]
>>> d=()
>>> d={}
>>>

Erroneous extra lines in IDLE 3.6+ Shell but not editor:

>>> d = []
 
>>> d=()
 
>>> d={}
 
>>> d=[i for i in [1]]
 
>>> 

The 'blank' lines are indents produced by IDLE's smart indent mechanism, which 
is trigger by keying '\n', *before* the code is tentatively compiled.

While the extra lines are an error for the examples above, they are arguably 
correct for your example, where there is no closing '}'.  The indenter treats 
it the same as if there were a closing quote, as in the following, which *is* 
the same in shell and editor, and correct.

d = {1: 'one}'
 # Indent lines up next dict item with the one above.

Even though your example is no a bug, it lead me to discover a regression in 
current 3.6+.  In the past year, there have been a couple of patches that 
touched the autoindent code.

--
stage:  -> test needed
title: IDLE inserts extra blank line in prompt after SyntaxError -> IDLE: 
erroneous 'smart' indents in shell
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com