[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Anthony Sottile

Anthony Sottile added the comment:

Breaks this function:

```
def rmtree(path):
"""On windows, rmtree fails for readonly dirs."""
def handle_remove_readonly(func, path, exc):  # pragma: no cover (windows)
excvalue = exc[1]
if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES:
os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
func(path)
else:
raise
shutil.rmtree(path, ignore_errors=False, onerror=handle_remove_readonly)
```

--

___
Python tracker 

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



[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Larry Hastings

Larry Hastings added the comment:

Unless you can explain what bugs this is causing, I don't see any need to 
change the behavior.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Anthony Sottile

Anthony Sottile added the comment:

When calling shutil.rmtree on windows on a readonly directory, the error 
handler is called with os.unlink as the first argument `func` which fails the 
check `func in (os.rmdir, os.remove)` which succeeded on previous python 
versions

--

___
Python tracker 

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



[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Larry Hastings

Larry Hastings added the comment:

How does it break?  Maybe you could explain more.

--

___
Python tracker 

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



[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Anthony Sottile

New submission from Anthony Sottile:

I've confirmed this bug is present on both windows and linux, the outputs below 
are from linux however.

Compare:

```
$ python3.4 --version
Python 3.4.3
$ python3.4 -c 'import os; print(os.unlink == os.remove)'
True
```

```
$ python3.5 --version
Python 3.5.0
$ python3.5 -c 'import os; print(os.unlink == os.remove)'
False
```

The docs say: https://docs.python.org/3/library/os.html#os.remove

"This function is identical to unlink()."

To me identity means `is` but I at least expect the `==` behaviour of previous 
versions.

--
messages: 256880
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: os.unlink != os.remove in python3.5
versions: Python 3.5

___
Python tracker 

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



[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Eryk Sun

Eryk Sun added the comment:

This is due to using argument clinic in Modules/posixmodule.c:

/*[clinic input]
os.remove = os.unlink

builtin_function_or_method instances are equal if m_self (the module in this 
case) and m_ml->ml_meth (the C function) are the same. In 3.4, the function 
posix_unlink is used for both os.unlink and os.remove, which is why they 
compare as equal. In 3.5, argument clinic defines separate os_unlink and 
os_remove implementations in Modules/clinic/posixmodule.c.h.

--
components: +Argument Clinic, Library (Lib)
nosy: +eryksun, larry
versions: +Python 3.6

___
Python tracker 

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