[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-04-07 Thread Nick Coghlan

Nick Coghlan  added the comment:

Some notes from my investigation of bpo-33185 that seem more appropriate here, 
rather than on that issue:

* several of the developer-centric utilities in the standard library have a 
shared need to be friendly to imports from the current working directory.
* timeit uses os.curdir, but could be switched to os.getcwd()
* pydoc uses a literal '.', but could be switched to os.getcwd()
* trace, profile, cProfile, pdb, doctest, and IDLE's pyshell all add the 
directory containing the file under test

Aside from switching pydoc from a literal '.' to os.curdir, I'm not going to 
change any of those (hence why I'm putting these notes here), but I wanted to 
capture this info in case does decide to follow through on a "less isolated 
than isolated mode, but still omits the current directory from sys.path" 
execution mode.

--

___
Python tracker 

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



[issue33240] shutil.rmtree fails when the inner floder is opened in Explorer on Windows

2018-04-07 Thread Eryk Sun

Eryk Sun  added the comment:

This is not an uncommon problem. If there's one or more existing references to 
a file or empty directory that were opened with shared delete access, then a 
delete operation will succeed, but the file or directory will not be unlinked 
from the parent directory. The filesystem only unlinks a file or directory if 
its "delete disposition" is set when the last reference is closed. 

Removing the parent directory thus requires a loop that retries the delete 
until it succeeds, i.e. until existing references are closed and the directory 
finally becomes empty and thus deletable. If the problem is caused by an 
anti-malware program, it should typically be resolved within a short time. 
Exactly how long to wait in a retry loop before failing the operation should be 
configurable.

Maybe you can conduct a simple experiment to measure the wait time required in 
your case. Run the following with "bar" opened in Explorer. Substitute the real 
path of "foo" in PARENT_PATH.

import os
import time

ERROR_DIR_NOT_EMPTY = 145

PARENT_PATH = 'foo'
CHILD_PATH = os.path.join(PARENT_PATH, 'bar')

os.rmdir(CHILD_PATH)
t0 = time.perf_counter()

while True:
try:
os.rmdir(PARENT_PATH)
wait_time = time.perf_counter() - t0
break
except OSError as e:
if e.winerror != ERROR_DIR_NOT_EMPTY:
   raise

print(wait_time)

--
components: +IO
nosy: +eryksun
stage:  -> test needed
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



[issue33240] shutil.rmtree fails when the inner floder is opened in Explorer on Windows

2018-04-07 Thread Yu Liu

New submission from Yu Liu :

Given the following directory structure on a Windows machine:
- foo
 - bar

a call to `shutil.rmtree("foo")` will fail when the inner folder `bar` is 
opened in an Explorer. The error message indicates the `foo` directory is not 
empty, while after the execution, although it failed, the `foo` directory is 
empty. So the inner folder `bar` was removed successfully, but `foo` was not. 
And the error message is misleading.

It will not fail when `foo` is opened in an Explorer, neither on Linux system.

--
components: Library (Lib), Windows
messages: 315077
nosy: giampaolo.rodola, paul.moore, philius, steve.dower, tarek, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: shutil.rmtree fails when the inner floder is opened in Explorer on 
Windows
type: behavior
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



[issue33237] Improve AttributeError message for partially initialized module

2018-04-07 Thread Nick Coghlan

Nick Coghlan  added the comment:

Oops, just realised my suggested text had an extraneous double quote in it due 
to a copy-and-paste error. Fixed version:

AttributeError: partially initialized module 'spam' has no attribute 'ham' 
(most likely due to a circular import).

--

___
Python tracker 

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



[issue23403] Use pickle protocol 4 by default?

2018-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Is there something left to be done here?

--

___
Python tracker 

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



[issue33211] lineno and col_offset are wrong on function definitions with decorators

2018-04-07 Thread Ethan Smith

Ethan Smith  added the comment:

In my PR, I added `def_lineno` and `class_lineno` as fields in the ASDL, 
instead of attributes (since constructors cannot have attributes, only types 
can). This means they show up in `ast.dump` which is probably not the desired 
behavior, as it makes the dumped ast whitespace/line offset sensitive.

Therefore I propose we change the line number of the nodes to be the one of the 
def/class statement. It seems based on [this 
commit](https://github.com/python/cpython/commit/09aaa88328a5083469b2682230c7f3c62942afab)
 that the change was done to fix inspect.getsource (so that it started on the 
first decorator), but I think it is much more logical for inspect to handle 
decorated items instead of having the ast lie.

One other option could be for a modified ast to have a decorated node, which 
holds the decorator list, and the class/function. This has the possible 
downside of being a not-insignificant change to the ast.

--

___
Python tracker 

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



[issue29613] Support for SameSite Cookies

2018-04-07 Thread Alex Gaynor

Change by Alex Gaynor :


--
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



[issue29613] Support for SameSite Cookies

2018-04-07 Thread Alex Gaynor

Alex Gaynor  added the comment:


New changeset c87eb09d2e3783b0b5dc0d7cb304050cbcc86ad3 by Alex Gaynor in branch 
'master':
bpo-29613: Added support for SameSite cookies (GH-6413)
https://github.com/python/cpython/commit/c87eb09d2e3783b0b5dc0d7cb304050cbcc86ad3


--
nosy: +alex

___
Python tracker 

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



[issue33239] tempfile module: functions with the 'buffering' option are incorrectly documented

2018-04-07 Thread Martin Falatic

New submission from Martin Falatic :

The documentation for the tempfile module in Python 3.x for the `buffering` 
option is incorrect:

https://docs.python.org/3/library/tempfile.html

TemporaryFile, NamedTemporaryFile, and SpooledTemporaryFile all take the 
`buffering` option, which in turn appears to correlate to the Python 2.7 option 
`bufsize`, which was and continues to be an integer (per the source).

In the 3.x documentation the default signature for TemporaryFile, 
NamedTemporaryFile, and SpooledTemporaryFile includes `buffering=None`. 
Actually specifying None as a default for this will cause an exception 
(`TypeError: an integer is required (got type NoneType)`).

There is a cross-reference in the 3.x tempfile docs to `open` 
(https://docs.python.org/3/library/functions.html#open) which in turn shows the 
correct signature to use for `buffering`. Additionally, the source code is 
clearly documented 
(https://github.com/python/cpython/blob/master/Lib/tempfile.py)

A good correction would be to ensure `buffering=-1` is documented as the 
default for the three functions in tempfile, with an additional note explicitly 
stating that -1 == no buffering, and the existing `open` cross-reference 
retained.

--
assignee: docs@python
components: Documentation
messages: 315072
nosy: MartyMacGyver, docs@python
priority: normal
severity: normal
status: open
title: tempfile module: functions with the 'buffering' option are incorrectly 
documented
versions: Python 3.4, Python 3.5, Python 3.6, 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



[issue33237] Improve AttributeError message for partially initialized module

2018-04-07 Thread Brett Cannon

Brett Cannon  added the comment:

+1 from me for Nick's suggestion.

--

___
Python tracker 

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



[issue29613] Support for SameSite Cookies

2018-04-07 Thread Alex Gaynor

Change by Alex Gaynor :


--
keywords: +patch
pull_requests: +6118

___
Python tracker 

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



[issue33201] Modernize "Extension types" documentation

2018-04-07 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
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



[issue33201] Modernize "Extension types" documentation

2018-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset b603609e9dd19268b61b52e701cc0ee8e86784c5 by Antoine Pitrou in 
branch '3.6':
[3.6] bpo-33201: Modernize "Extension types" doc (GH-6337) (GH-6412)
https://github.com/python/cpython/commit/b603609e9dd19268b61b52e701cc0ee8e86784c5


--

___
Python tracker 

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



[issue33201] Modernize "Extension types" documentation

2018-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 31f1b52f1f6c2d84eacf3c6db3f6b9adf04b675e by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.7':
bpo-33201: Modernize "Extension types" doc (GH-6337) (GH-6411)
https://github.com/python/cpython/commit/31f1b52f1f6c2d84eacf3c6db3f6b9adf04b675e


--

___
Python tracker 

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



[issue33201] Modernize "Extension types" documentation

2018-04-07 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
pull_requests: +6117

___
Python tracker 

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



[issue33201] Modernize "Extension types" documentation

2018-04-07 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6116

___
Python tracker 

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



[issue33201] Modernize "Extension types" documentation

2018-04-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 1d80a561734b9932961c546b0897405a3bfbf3e6 by Antoine Pitrou in 
branch 'master':
bpo-33201: Modernize "Extension types" doc (GH-6337)
https://github.com/python/cpython/commit/1d80a561734b9932961c546b0897405a3bfbf3e6


--

___
Python tracker 

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



[issue33213] crypt function not hashing properly on Mac (uses a specific salt)

2018-04-07 Thread Ron Reiter

Change by Ron Reiter :


--
type:  -> security

___
Python tracker 

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



[issue33211] lineno and col_offset are wrong on function definitions with decorators

2018-04-07 Thread Ethan Smith

Change by Ethan Smith :


--
keywords: +patch
pull_requests: +6115
stage:  -> patch review

___
Python tracker 

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



[issue23649] tarfile not re-entrant for multi-threading

2018-04-07 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

extract_from_pkgs() in the attached extract_from_packages.py script extracts 
/etc files from the tar files in PKG_DIR into WORK_DIR using a 
ThreadPoolExecutor (a ThreadPoolExecutor, when used to extract all the /etc 
files from the packages that build a whole ArchLinux system, divides the 
elapsed time by 2). Running this script that tests this function fails randomly 
with the same error as reported by Srdjan in msg237961.

Replacing ThreadPoolExecutor with ProcessPoolExecutor also fails randomly.

Using the safe_makedirs() context manager to enclose the statements than run 
ThreadPoolExecutor fixes the problem.

Obviously this in not a problem related to thread-safety (it occurs also with 
ProcessPoolExecutor) but a problem about the robustness of the tarfile module 
in a concurrent access context. The problem is insidious in that it may never 
occur in an application test suite.

--
nosy: +xdegaye
Added file: https://bugs.python.org/file47523/extract_from_packages.py

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-07 Thread Ned Deily

Ned Deily  added the comment:


New changeset 76215a4481191b648de522a4e2120f60822f6b9c by Ned Deily in branch 
'3.6':
bpo-33184: Update macOS installer build to use OpenSSL 1.0.2o. (GH-6408)
https://github.com/python/cpython/commit/76215a4481191b648de522a4e2120f60822f6b9c


--

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-07 Thread Ned Deily

Ned Deily  added the comment:


New changeset 12d1dcd1f8ec0a2f3d8c325aa8e3f2f05b75b188 by Ned Deily (Miss 
Islington (bot)) in branch '3.7':
bpo-33184: Update macOS installer build to use OpenSSL 1.1.0h. (GH-6407) 
(GH-6409)
https://github.com/python/cpython/commit/12d1dcd1f8ec0a2f3d8c325aa8e3f2f05b75b188


--

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-07 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6114

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-07 Thread Ned Deily

Ned Deily  added the comment:


New changeset b405752dab95fa5dc65a19d94e798844d0378c61 by Ned Deily in branch 
'master':
bpo-33184: Update macOS installer build to use OpenSSL 1.1.0h. (GH-6407)
https://github.com/python/cpython/commit/b405752dab95fa5dc65a19d94e798844d0378c61


--

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-07 Thread Ned Deily

Change by Ned Deily :


--
pull_requests: +6113

___
Python tracker 

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



[issue33184] Update OpenSSL to 1.1.0h / 1.0.2o

2018-04-07 Thread Ned Deily

Change by Ned Deily :


--
keywords: +patch
pull_requests: +6112
stage: needs patch -> patch review

___
Python tracker 

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