[issue40726] ast.Call end_lineno is defined and returns None

2020-05-22 Thread David Strobach


David Strobach  added the comment:

> Actually, Xonsh tests show that keyword AST nodes are missing 'lineno' 
> attribute, but that could be our fault.

Yes, our fault. Sorry for the noise.

--

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



[issue40726] ast.Call end_lineno is defined and returns None

2020-05-22 Thread David Strobach


David Strobach  added the comment:

Actually, Xonsh (http://github.com/xonsh/xonsh) tests show that keyword AST 
nodes are missing 'lineno' attribute, but that could be our fault.

--

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



[issue40726] ast.Call end_lineno is defined and returns None

2020-05-22 Thread David Strobach


David Strobach  added the comment:

The issue is not limited to ast.Call. Other AST nodes are also affected (e.g. 
ast.BinOp). It's also not limited to end_lineno attribute. The same applies to 
end_col_offset.

--

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



[issue40726] ast.Call end_lineno is defined and returns None

2020-05-22 Thread David Strobach


Change by David Strobach :


--
nosy: +laloch

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



[issue40238] os.stat() on Windows succeeds for nonexistent paths with trailing spaces

2020-04-10 Thread David Strobach


David Strobach  added the comment:

Hi Eryk, thanks for your time and for the explanation.

> The Windows file API normalizes paths to replace forward slashes with 
> backslashes; resolve relative paths and "." and ".." components; strip 
> trailing spaces and dots from the final component; and map reserved DOS 
> device names in the final component of non-UNC paths to device paths (e.g. 
> "C:/Temp/con " -> r"\\.\con").

OK, I understand. I know that Win32 documentation suggests to avoid using paths 
with trailing spaces and that the paths are subject to normalization. Then I'd 
say os.path.normpath() should  perform the same (GetFullPathNameW?) 
normalization as os.stat() and friends do.

Currently:

>>> import os
>>> path = r"c:\Program Files "
>>> os.path.normpath(path)
'c:\\Program Files '
>>> os.path.realpath(path)
'C:\\Program Files'

--

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



[issue40238] os.stat() on Windows succeeds for nonexistent paths with trailing spaces

2020-04-09 Thread David Strobach


New submission from David Strobach :

On Windows (Server 2012 R2 in my case) os.stat() seems to be striping 
significant trailing spaces off the path argument:

>>> import os
>>> os.stat("c:\\Program Files ")
os.stat_result(st_mode=16749, st_ino=281474976710717, st_dev=173025906, 
st_nlink=1, st_uid=0, st_gid=0, st_size=8192, st_atime=1586154685, 
st_mtime=1586154685, st_ctime=1377178576)
>>> os.stat("c:\\Program Files\\ ")
os.stat_result(st_mode=16749, st_ino=281474976710717, st_dev=173025906, 
st_nlink=1, st_uid=0, st_gid=0, st_size=8192, st_atime=1586154685, 
st_mtime=1586154685, st_ctime=1377178576)
>>> # consequently
>>> os.path.isdir("c:\\Program Files\\ ")
True
>>> os.path.isdir("c:\\Program Files ")
True
>>> os.scandir("c:\\Program Files ")
Traceback (most recent call last):
  File "", line 1, in 
FileNotFoundError: [WinError 3] The system cannot find the path specified: 
'c:\\Program Files '

The same also applies to regular files, not just directories.

--
components: Library (Lib), Windows
messages: 366054
nosy: David Strobach, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.stat() on Windows succeeds for nonexistent paths with trailing spaces
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

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