[issue28808] Make PyUnicode_CompareWithASCIIString() never failing

2016-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Xiang.

Ned, I ask your permission for committing this patch in 3.6. This is not 
critical neither new bug, it was introduced in 3.3 and is rarely reproducible. 
But 3.6b4 is the first version in which the changed behavior was documented, 
and this patch reverts the documentation change together with fixing the 
behavior. If release 3.6.0 without this patch, this will encourage users to 
change their code for handling possible error in 
PyUnicode_CompareWithASCIIString(), but these changes will be not needed when 
commit the patch.

--
nosy: +ned.deily

___
Python tracker 

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



[issue28334] netrc does not work if $HOME is not set

2016-11-27 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue14844] netrc does not handle accentuated characters

2016-11-27 Thread Xiang Zhang

Xiang Zhang added the comment:

I opened #28806 to improve netrc library. This could be solved if it's merged.

--
dependencies: +Improve the netrc library
nosy: +xiang.zhang

___
Python tracker 

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



[issue28808] Make PyUnicode_CompareWithASCIIString() never failing

2016-11-27 Thread Xiang Zhang

Xiang Zhang added the comment:

LGTM.

Although at first I am not in favour of this change but searching Github it 
seems all usages of this API doesn't check the possible error.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue28779] set_forkserver_preload() can crash the forkserver if preloaded module instantiate multiprocessing classes

2016-11-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Slight mistake in my explanation: the method in the base class raises 
ValueError, not NotImplementedError. Still, the basic explanation stands.

(that said, if you think this is out of scope for this issue, I can revert that 
part of the patch)

--

___
Python tracker 

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



[issue28779] set_forkserver_preload() can crash the forkserver if preloaded module instantiate multiprocessing classes

2016-11-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> I noticed something by accident when trying your example script

That's due to the way I wrote the script (the use of __file__ to deduce the 
module name to preload), not anything inherent in the bug described here.

>  looking at the file you attached, did everything make it into the patch?

Yes.

> I ask because unless I'm missing something it looks like the patch adds 
> arguments to the function signature but does not act upon them in any new way?

It does not. It's only fixing the signature of the method in the base class 
(which raises NotImplementedError) to match the signature of the method in the 
derived class (which is the only one actually called).

--

___
Python tracker 

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



[issue24142] ConfigParser._read doesn't join multi-line values collected while reading if a ParsingError occured

2016-11-27 Thread Florian Höch

Florian Höch added the comment:

> Thanks for your patch! As you can see, 2.7 is no longer touched as the
codebases diverged.

Thanks, although I have to say it's a little bit unfortunate that Python
2.7 will be left in a worse state than 2.6 where this bug did not exist.

--

___
Python tracker 

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



[issue28779] set_forkserver_preload() can crash the forkserver if preloaded module instantiate multiprocessing classes

2016-11-27 Thread Davin Potts

Davin Potts added the comment:

Antoine: I'm still unclear on what's going on here but I noticed something by 
accident when trying your example script.  Specifically, when I ran your script 
from the directory where it exists on disk, I could successfully reproduce what 
you described but if I ran your script from a different working directory (e.g. 
'python3.5 ../tmp/issue_28779_repro.py') then I did not see the misbehavior and 
it instead ran through to completion without any exceptions reported.  I saw 
this phenomenon (all that I described above) on both OSX and Ubuntu 16.04 
systems.

Secondly, looking at the file you attached, did everything make it into the 
patch?  I ask because unless I'm missing something it looks like the patch adds 
arguments to the function signature but does not act upon them in any new way?

--

___
Python tracker 

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



[issue28800] Add RETURN_NONE bytecode instruction

2016-11-27 Thread Tim Peters

Tim Peters added the comment:

I also don't see a good reason to keep this open now - adds complication for no 
quantifiable payoff.

--

___
Python tracker 

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



[issue12844] Support more than 255 arguments

2016-11-27 Thread Brett Cannon

Brett Cannon added the comment:

Patch LGTM.

--
assignee:  -> serhiy.storchaka
stage: patch review -> commit review

___
Python tracker 

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



[issue28810] Document bytecode changes in 3.6

2016-11-27 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue28800] Add RETURN_NONE bytecode instruction

2016-11-27 Thread Brett Cannon

Brett Cannon added the comment:

My vote is to close this issue since the performance isn't panning out.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

After some further thought, I am open to changing the C API to accept either 
hi=None or hi=-1 to reconcile the implementation details without breaking any 
existing code that relies on either.  That would let the argument clinic expose 
a default value of hi=None.  That isn't perfect because it complicates the code 
and it exposes an implementation detail contrary to what the API originally 
intended.

Short of that, this module ought to be skipped for the argument clinic pending 
a build-out of signature objects to handle signatures that vary depending on 
the number of arguments supplied.

--

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2016-11-27 Thread Eric N. Vander Weele

Eric N. Vander Weele added the comment:

I may be able to simplify the build on AIX by removing ld_so_aix and python.exp 
entirely.  Would this be a preferred solution if I am able to get something 
working?  If so, should I create a separate issue to track the change?

--

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> I would suggest to use sys.maxsize for default value in Argument Clinic

No thanks.  I don't want to subtly change the API for this module or even 
suggest to users that it might be a good idea to set hi > len.  Further, we 
don't want to slow the pure python code for this pointless extension.

Really, we're dancing around the issue that argument clinic and signatures need 
to become more expressive, allowing for omitted arguments without requiring a 
default value.  Waiting for this to be done is far preferable to mangling 
long-standing APIs to force fit them to into argument clinic.

Elsewhere, we've shown self discipline and restraint when applying AC, skipping 
over cases where it doesn't fit.  If we can't find a way to apply AC without 
changing this API, this issue should be closed and deferred until AC grows the 
requisite expressive power.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue28800] Add RETURN_NONE bytecode instruction

2016-11-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

When we added LIST_APPEND (the first of the custom opcodes intended for 
optimization), it was done only because it was frequently used in inner loops 
where it provided real benefits to users.

In contrast this opcode seems like a waste.  Historically for opcodes, we've 
valued orthogonality and parsimony.  The opcode set was intentionally kept 
simple and minimal.  The recent opcode additions have disregarded these values.

--
nosy: +tim.peters

___
Python tracker 

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



[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FWIW, we intentionally decided not to do this when constant folding was added.  
The idea was to keep the peephole optimizer simple and to have it do the 
minimum work necessary to get its job done (optimizing the constants table 
takes extra time to do but doesn't result in faster code).  

Another reason was that aside from contrived examples (such as the OP's 
example), very little real-world code gets any benefit and the benefit tends to 
be very small.  (In other words, no one will actually notice or benefit from 
this patch, but their compilation times will all slow down slightly).

Lastly, the intention is to stop building out constant folding.  The correct 
place for constant folding is upstream, using AST prior to code generation.

--
nosy: +rhettinger

___
Python tracker 

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



[issue28728] test_host_resolution in test_socket fails

2016-11-27 Thread Xiang Zhang

Xiang Zhang added the comment:

The three ipv6 addresses are all invalid addresses if we conform to spec.

"::1q"  non hex characteres
"::1::2"two "::" but at most one is allowed
"1:1:1:1:1:1:1:1:1" 144 bits > 128 bits

> Perhaps this is similar to the problems encountered with test_bad_address() 
> at Lib/test/test_urllibnet.py:102

I think they are the similar situations.

--

___
Python tracker 

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



[issue28815] test_socket fails if /proc/modules is existent but not readable

2016-11-27 Thread patrila

New submission from patrila:

Dear Python developers

The test_socket test fails if /proc/modules is existent but not readable by the 
user (this is for example the case with the grsecurity patchset of the kernel).

The method reading /proc/modules is isTipcAvailable(), which is not a test but 
a guard for other tests.
It seems reasonable to return False in the case that /proc/modules is not 
readable (but existent).
The method isTipcAvailable() already returns False if /proc/modules is non 
existent (but fails to return False if it's not readable).

Attached a proposed test. Feel free to remove the EISDIR in case you feel 
uncomfortable and want a it be a "real" error.
The patch should be applied to both Python-2.7 and Python-3.x.

Kind regards

Here is the inline version of the patch; it's also attached.

diff -r 876bee0bd0ba Lib/test/test_socket.py
--- a/Lib/test/test_socket.py   Sat Nov 26 14:04:40 2016 -0800
+++ b/Lib/test/test_socket.py   Sun Nov 27 17:00:55 2016 +0100
@@ -4779,12 +4779,21 @@
 """ 
 if not hasattr(socket, "AF_TIPC"):
 return False
-if not os.path.isfile("/proc/modules"):
-return False
-with open("/proc/modules") as f:
-for line in f:
-if line.startswith("tipc "):
-return True
+try:
+f = open("/proc/modules")
+except IOError as e:
+# It's ok if the file does not exist, is a directory or if we
+# have not the permission to read it. In any other case it's a
+# real error, so raise it again.
+if e.errno in (ENOENT, EISDIR, EACCES):
+return False
+else:
+raise
+else:
+with f:
+for line in f:
+if line.startswith("tipc "):
+return True
 return False

 @unittest.skipUnless(isTipcAvailable(),

--
files: test_socket_isTipcAvailable_proc_modules.patch
keywords: patch
messages: 281828
nosy: patrila
priority: normal
severity: normal
status: open
title: test_socket fails if /proc/modules is existent but not readable
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: 
http://bugs.python.org/file45666/test_socket_isTipcAvailable_proc_modules.patch

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2016-11-27 Thread Eric N. Vander Weele

Eric N. Vander Weele added the comment:

I also have found this goes back since Python 2.7.

I have refreshed the patched for the tip of CPython.  What can I do to help 
push this forward?

--
title: parallel build race condition on AIX since python-3.2 -> Parallel build 
race condition on AIX since python-2.7
Added file: 
http://bugs.python.org/file45665/aix-parallel-build-race-refresh.patch

___
Python tracker 

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



[issue19521] parallel build race condition on AIX since python-3.2

2016-11-27 Thread Eric N. Vander Weele

Changes by Eric N. Vander Weele :


--
nosy: +ericvw
versions: +Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue27172] Undeprecate inspect.getfullargspec()

2016-11-27 Thread Nick Coghlan

Nick Coghlan added the comment:

Initial patch attached. Key missing pieces:

- needs a What's New note
- needs to undeprecate inspect.getcallargs() as well (more on that below)

As my last couple of comments indicate, I'd forgotten that only getargspec() 
was programmatically deprecated, which means the sole code change is a 
rewording of the getargspec() warning to mention both signature() and 
getfullargspec().

The documentation changes are a bit more extensive, as I couldn't resist fixing 
the longstanding terminology error in the docs and docstrings, where these 
functions are mostly reporting *parameter* names, not argument names (callable 
arguments have values, not names).

I think the "versionchanged" note works well for indicating that folks aren't 
imagining things if they remembered seeing this function marked as deprecated.

However, I also went back and checked the 3.5 What's New, and that does mention 
the deprecations, so I'll need to do another version of this patch that 
includes a 3.6 What's New notice retracting those deprecations.

That check also reveals some other documented deprecations that should probably 
be reverted.

Firstly, getargvalues() and formatargvalues() are *frame* introspection 
functions, and hence have nothing whatsoever to do with inspect.signature(). 
The code and docs are just a bit confusing as they're interleaved with the 
callable introspection functions. I've filed that as a new issue: 
http://bugs.python.org/issue28814

Secondly, https://bugs.python.org/issue20438#msg254892 notes that 
inspect.getcallargs() has some behaviours that differ from Signature.bind in a 
way that's a bit of a pain to replicate on top of the latter. Similar to 
getfullargspec(), what do folks think of the idea of reverting that deprecation 
at least until 2.7 goes EOL?

(Noting for the record so folks don't wonder if it's an accidental oversight: I 
think formatargspec should retain its documented deprecation, as folks really 
are better off writing their own formatting function based on the data returned 
or switching to the new signature API)

--
keywords: +patch
Added file: 
http://bugs.python.org/file45663/issue27172_undeprecate_getfullargspec.diff

___
Python tracker 

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



[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Adrian Wielgosik

Adrian Wielgosik added the comment:

Attached squashed patch.

> But moving constant folding from the peephole optimizer to the AST level 
> (...) would totally eliminate the need in your patch.

I'm aware of that and I'm okay with it. I chose an unfortunate moment for 
implementing this :)

--
Added file: http://bugs.python.org/file45664/clean_co_consts_squashed.patch

___
Python tracker 

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



[issue28814] Deprecation notice on inspect.getargvalues() is incorrect

2016-11-27 Thread Nick Coghlan

New submission from Nick Coghlan:

inspect.getargvalues() and inspect.formatargvalues() were deprecated in Python 
3.5 as part of implementing issue 20438

This is incorrect, as these are *frame* introspection related functions, not 
callable introspection ones. The documentation and implementation layout is 
confusing though, as they're interleaved with the callable introspection 
operations.

--
assignee: docs@python
components: Documentation
messages: 281824
nosy: docs@python, ncoghlan, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: Deprecation notice on inspect.getargvalues() is incorrect
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue28775] Option to set startup directory in IDLE

2016-11-27 Thread Nofar Schnider

Nofar Schnider added the comment:

Thanks Terry.
I am working on my Macbook Pro so my OS is macOS Sierra. Would love to test on 
it and also, I am able to test on several VMs with different Unix distributions.
I am interested in anything that: 1) can help the Python community. 2) I could 
learn from. So the answer is YES.

Just let me know where to start!

--

___
Python tracker 

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



[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your patch Adrian. I haven't close look, but at first glance your 
patch looks correct, and the idea looks great.

But moving constant folding from the peephole optimizer to the AST level 
(issue1346238, issue11549) would totally eliminate the need in your patch. I'll 
push your patch if AST optimizer will be not implemented in 3.7.

On other hand, your patch looks simple enough, and my be pushed first.

It would be easy to review if provide your changes as one patch.

--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
priority: normal -> low
stage:  -> patch review

___
Python tracker 

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



[issue28800] Add RETURN_NONE bytecode instruction

2016-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The pair LOAD_CONST/RETURN_VALUE is on 19th place of the top of opcode pairs 
(see msg269391 in issue27255). Not all of these constants are None. And since 
the time of LOAD_CONST is much smaller then the time of RETURN_VALUE (the 
latter includes destroying a frame and should be in a pair with CALL_FUNCTION), 
I think the performance effect of RETURN_NONE is much less than 1%.

--

___
Python tracker 

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



[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Adrian Wielgosik

Changes by Adrian Wielgosik :


Added file: http://bugs.python.org/file45662/clean_co_consts.patch

___
Python tracker 

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



[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Adrian Wielgosik

Changes by Adrian Wielgosik :


--
keywords: +patch
Added file: http://bugs.python.org/file45661/indices_tweak.patch

___
Python tracker 

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



[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Adrian Wielgosik

New submission from Adrian Wielgosik:

The attached patch adds new logic to peephole compiler to remove constants that 
are no longer needed after the main peephole pass.

For example:

def f():
var = 'te' + 'xt'
num = -12
num = -6 * 2
return (1, (3, 4), 6)
print(f.__code__.co_consts)

Without the patch:

(None, 'te', 'xt', 12, 6, 2, 1, 3, 4, 'text', -12, -6, -12, (3, 4), (1, (3, 
4), 6))

With patch:

(None, 'text', -12, -12, (1, (3, 4), 6))

(unfortunately, I couldn't get rid of None because that would make 'text' a 
docstring)

For convenience, I've written the patch in two parts.
The first one just changes the CONST_STACK_* macros to store the co_const 
indices instead of the constants themselves, the second one is the actual 
implementation of the new logic.

Aside from simply having to store less objects around, this also makes 
co_consts contents closer together. This may help the cache a little bit.

-

I did run benchmarks multiple times, but it looked like all the results were 
random noise. That makes sense, since I didn't directly affect the runtime.
The only consistently faster benchmark is:

- regex_dna: 288 ms +- 7 ms -> 275 ms +- 5 ms: 1.05x faster

I tried to measure the difference in compile time, but it too was lost in the 
noise.

-

I also compared size of compiled .pyc files in the Lib/ directory.
The gains are mostly very small.

_compat_pickle.cpython-37.pyc | 6554   -> 5851   | -10.7%
sre_compile.cpython-37.pyc| 10275  -> 10025  | -2.43%
hashlib.cpython-37.pyc| 6624   -> 6514   | -1.66%
pstats.cpython-37.pyc | 21755  -> 21435  | -1.47%
_markupbase.cpython-37.pyc| 7979   -> 7864   | -1.44%
pydoc.cpython-37.pyc  | 83899  -> 82712  | -1.41%
_strptime.cpython-37.pyc  | 15951  -> 15751  | -1.25%
__future__.cpython-37.pyc | 4155   -> 4105   | -1.2%
opcode.cpython-37.pyc | 5401   -> 5341   | -1.11%
colorsys.cpython-37.pyc   | 3299   -> 3263   | -1.09%
signal.cpython-37.pyc | 2503   -> 2478   | -0.999%
_osx_support.cpython-37.pyc   | 9663   -> 9568   | -0.983%
gettext.cpython-37.pyc| 13990  -> 13854  | -0.972%
getpass.cpython-37.pyc| 4223   -> 4183   | -0.947%
compare.cpython-37.pyc| 541-> 536| -0.924%
warnings.cpython-37.pyc   | 13328  -> 13208  | -0.9%
platform.cpython-37.pyc   | 27931  -> 27681  | -0.895%
imaplib.cpython-37.pyc| 42019  -> 41653  | -0.871%
webbrowser.cpython-37.pyc | 15836  -> 15702  | -0.846%
this.cpython-37.pyc   | 1253   -> 1243   | -0.798%
rlcompleter.cpython-37.pyc| 5768   -> 5723   | -0.78%
zipfile.cpython-37.pyc| 48024  -> 47672  | -0.733%
imghdr.cpython-37.pyc | 4138   -> 4108   | -0.725%
turtle.cpython-37.pyc | 131600 -> 130653 | -0.72%
timeit.cpython-37.pyc | 11676  -> 11596  | -0.685%
lzma.cpython-37.pyc   | 11980  -> 11900  | -0.668%
bz2.cpython-37.pyc| 11270  -> 11195  | -0.665%
aifc.cpython-37.pyc   | 25821  -> 25651  | -0.658%
gzip.cpython-37.pyc   | 16215  -> 16110  | -0.648%
uuid.cpython-37.pyc   | 20382  -> 20260  | -0.599%
plistlib.cpython-37.pyc   | 27354  -> 27191  | -0.596%
cProfile.cpython-37.pyc   | 4199   -> 4174   | -0.595%
tarfile.cpython-37.pyc| 62437  -> 62076  | -0.578%
sysconfig.cpython-37.pyc  | 15819  -> 15728  | -0.575%
profile.cpython-37.pyc| 13889  -> 13814  | -0.54%
random.cpython-37.pyc | 19177  -> 19074  | -0.537%
_threading_local.cpython-37.pyc   | 6609   -> 6574   | -0.53%
_dummy_thread.cpython-37.pyc  | 4839   -> 4814   | -0.517%
datetime.cpython-37.pyc   | 53722  -> 53445  | -0.516%
tracemalloc.cpython-37.pyc| 17218  -> 17131  | -0.505%
// remaining 129 files are < 0.5% smaller, 33 of them didn't change their size

--
components: Interpreter Core
messages: 281820
nosy: Adrian Wielgosik
priority: normal
severity: normal
status: open
title: Remove unneeded folded consts after peephole
type: resource usage
versions: Python 3.7

___
Python tracker 

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



[issue28682] Bytes support in os.fwalk()

2016-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Bytes path support is os.walk() is not documented. Actual behavior of 
os.fwalk() doesn't contradict the documentation.

--

___
Python tracker 

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



[issue28811] Make pathlib.PurePath.__str__ use shlex.quote

2016-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

open(str(path))

--

___
Python tracker 

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



[issue28494] is_zipfile false positives

2016-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

No, checking the first bytes of the file is not appropriate option. zipfile 
should support the Python zip application format [1].

I see two options:

1. Make is_zipfile() more strict that the ZipFile constructor. The later 
supports ZIP files with a data past the comment or with truncated comments, but 
the former should reject them.

2. Make both is_zipfile() and the ZipFile constructor more robust. They should 
check not just the EOCD signature, but check the Zip64 end of central directory 
record (if exists) and the first central file header signature (if the ZIP file 
is not empty).

It may be that PDF files contain PK\005\006 not accidentally, but because they 
contain embedded ZIP files (I don't know if this is a case). In that 
circumstances is_zipfile() returning True is correct.

[1] https://docs.python.org/3/library/zipapp.html

--

___
Python tracker 

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



[issue28812] Deadlock between GIL and pystate head_mutex.

2016-11-27 Thread INADA Naoki

New submission from INADA Naoki:

While investigating #28673, I found another deadlock relating to finalization 
and threading.

deadlocked thread (holding gil / waiting head_mutex):
#0  0x7f35dd400a07 in futex_abstimed_wait_cancelable (private=0, 
abstime=0x0, expected=0, futex_word=0x5557e6d3eeb0) at 
../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x5557e6d3eeb0, abstime=0x0) at 
sem_waitcommon.c:111
#2  0x7f35dd400ab4 in __new_sem_wait_slow (sem=0x5557e6d3eeb0, abstime=0x0) 
at sem_waitcommon.c:181
#3  0x7f35dd400b5a in __new_sem_wait (sem=sem@entry=0x5557e6d3eeb0) at 
sem_wait.c:29
#4  0x5557e64ec01b in PyThread_acquire_lock_timed (lock=0x5557e6d3eeb0, 
microseconds=-1, intr_flag=intr_flag@entry=0) at Python/thread_pthread.h:352
#5  0x5557e64ec148 in PyThread_acquire_lock (lock=, 
waitflag=waitflag@entry=1) at Python/thread_pthread.h:556
#6  0x5557e64d8dbb in tstate_delete_common 
(tstate=tstate@entry=0x7f35cc002a80) at Python/pystate.c:426
#7  0x5557e64d9e8d in PyThreadState_DeleteCurrent () at Python/pystate.c:462
#8  0x5557e662d339 in t_bootstrap (boot_raw=0x7f35dc186628) at 
./Modules/_threadmodule.c:1027
#9  0x7f35dd3f870a in start_thread (arg=0x7f35c3fff700) at 
pthread_create.c:333
#10 0x7f35dca220af in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:105

main thread (waiting gil / holding head_mutex):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at 
../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
#1  0x5557e65f1758 in PyCOND_TIMEDWAIT (us=5000, mut=0x5557e69cc860 
, cond=0x5557e69cc8a0 ) at Python/condvar.h:103
#2  take_gil (tstate=tstate@entry=0x5557e6d3f840) at Python/ceval_gil.h:224
#3  0x5557e65f3b14 in _PyEval_EvalFrameDefault (f=Frame 0x7f35d0001878, for 
file finish-deadlock.py, line 7, in __del__ (self=), throwflag=)
at Python/ceval.c:1140
#4  0x5557e65f1dcf in PyEval_EvalFrameEx (f=f@entry=Frame 0x7f35d0001878, 
for file finish-deadlock.py, line 7, in __del__ (self=), throwflag=throwflag@entry=0)
at Python/ceval.c:718
#5  0x5557e65f1eab in _PyFunction_FastCall (co=co@entry=0x7f35dc50eac0, 
args=0x7fff1a1e2878, args@entry=0x7fff1a1e2870, nargs=nargs@entry=1, 
globals=globals@entry={'__name__': '__main__', '__doc__': None, 
'__package__': None, '__loader__': , '__spec__': None, 
'__annotations__': {}, '__builtins__': , 
'__cached__': None, 'sys': , 'time': , 'threading': , 'C': 
, 'worker': , 
'_': 4, 't': , 
_started=, 
acquire=, release=, _waiters=) at remote 0x7f35dc191538>,...(truncated)) at 
Python/ceval.c:4881
#6  0x5557e65feb04 in _PyFunction_FastCallDict (func=func@entry=, args=args@entry=0x7fff1a1e2870, nargs=nargs@entry=1, 
kwargs=kwargs@entry=0x0)
at Python/ceval.c:4983
#7  0x5557e6500386 in _PyObject_FastCallDict (func=func@entry=, args=args@entry=0x7fff1a1e2870, nargs=nargs@entry=1, 
kwargs=kwargs@entry=0x0)
at Objects/abstract.c:2301
#8  0x5557e6500644 in _PyObject_Call_Prepend (func=, obj=obj@entry=, 
args=args@entry=(), kwargs=kwargs@entry=0x0)
at Objects/abstract.c:2364
#9  0x5557e651c2e4 in method_call (method=method@entry=, args=args@entry=(), kwargs=kwargs@entry=0x0) at 
Objects/classobject.c:317
#10 0x5557e6500247 in _PyObject_FastCallDict (func=func@entry=, args=args@entry=0x0, nargs=nargs@entry=0, 
kwargs=kwargs@entry=0x0) at Objects/abstract.c:2322
#11 0x5557e65f34a2 in PyEval_CallObjectWithKeywords 
(func=func@entry=, args=args@entry=0x0, 
kwargs=kwargs@entry=0x0) at Python/ceval.c:4705
#12 0x5557e6577f0d in slot_tp_finalize (self=) at 
Objects/typeobject.c:6416
#13 0x5557e655a07c in PyObject_CallFinalizer (self=self@entry=) at Objects/object.c:297
#14 0x5557e655adb7 in PyObject_CallFinalizerFromDealloc (self=self@entry=) at Objects/object.c:314
#15 0x5557e656cfde in subtype_dealloc (self=self@entry=) at Objects/typeobject.c:1151
#16 0x5557e655ae75 in _Py_Dealloc (op=) at 
Objects/object.c:1786
#17 0x5557e65312c5 in frame_dealloc (f=f@entry=Frame 0x7f35c40026a8, for 
file finish-deadlock.py, line 22, in worker ()) at Objects/frameobject.c:423
#18 0x5557e655ae75 in _Py_Dealloc (op=Frame 0x7f35c40026a8, for file 
finish-deadlock.py, line 22, in worker ()) at Objects/object.c:1786
#19 0x5557e64e88c1 in tb_dealloc (tb=tb@entry=0x7f35dc193f38) at 
Python/traceback.c:55
#20 0x5557e655ae75 in _Py_Dealloc (op=) 
at Objects/object.c:1786
#21 0x5557e64d98f3 in PyThreadState_Clear 
(tstate=tstate@entry=0x5557e6e307f0) at Python/pystate.c:403
#22 0x5557e64d99cf in PyInterpreterState_Clear 
(interp=interp@entry=0x5557e6d3f390) at Python/pystate.c:119
#23 

[issue28811] Make pathlib.PurePath.__str__ use shlex.quote

2016-11-27 Thread Ram Rachum

Ram Rachum added the comment:

"This will break any code that pass str(path) to API that doesn't support 
pathlib."

I don't understand. Can you give a concrete example of code it would break?

--

___
Python tracker 

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



[issue28811] Make pathlib.PurePath.__str__ use shlex.quote

2016-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This will break any code that pass str(path) to API that doesn't support 
pathlib.

In your case you can introduce a short alias:

q = shlex.quote
ssh_client.run(f'/bin/rm {q(str(path))}')

Or add more convenient helper:

def q(path):
return shlex.quote(str(path))

ssh_client.run(f'/bin/rm {q(path)}')

--
nosy: +serhiy.storchaka
resolution:  -> rejected
stage:  -> 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



[issue27647] Update Windows build to Tcl/Tk 8.6.6

2016-11-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Larry, Benjamin, what do you think about updating the version of Tcl/Tk shipped 
with 3.5 and 2.7 on Windows?

Tcl/Tk 8.6.6 Jul 27, 2016
Tcl/Tk 8.5.19 Feb 12, 2016

Currently used releases:

In 3.5: 8.6.4.2
In 2.7: 8.5.15.0

--
nosy: +benjamin.peterson, larry

___
Python tracker 

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



[issue28811] Make pathlib.PurePath.__str__ use shlex.quote

2016-11-27 Thread Ram Rachum

New submission from Ram Rachum:

I have a a PurePath object like so:

path = PurePath('/home/my awesome user/file.txt')

I'm SSHing into a server and I want to remove the file. So I have to do this: 

ssh_client.run(f'/bin/rm {shlex.quote(str(path))}')

Which is really long and ugly. (I might have been able to remove the str from 
there if #28623 wasn't rejected.)

I wish I could do this: 

ssh_client.run(f'/bin/rm {path}')

But since my path has a space, that would only be possible if PurePath.__str__ 
were to use shlex.quote, and put quotes around my path (only if it includes a 
space).

What do you think about that?

--
components: Library (Lib)
messages: 281812
nosy: cool-RR, pitrou
priority: normal
severity: normal
status: open
title: Make pathlib.PurePath.__str__ use shlex.quote
type: enhancement
versions: Python 3.7

___
Python tracker 

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