[issue27059] find_spec and find_loader ignore package/path argument

2016-05-20 Thread Gerrit Ansmann

Gerrit Ansmann added the comment:

> If you think the docs aren't clear enough then please feel free to submit a 
> patch to make them a bit clearer.

I intend to do that. However, before I do so: Given that `find_loader` shall be 
superseded by `find_spec`, how would I use the latter to find the specs of a 
module that is not located in the current path, i.e., what is the current, 
non-deprecated way of doing `find_loader("spam", ["/foo/bar/"])`?

--

___
Python tracker 

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



[issue27070] Add ability to freeze (seal) mutable objects

2016-05-20 Thread Марк Коренберг

Марк Коренберг added the comment:

Great. Do you have information why this PEP was rejected? This was exactly what 
I want.

--

___
Python tracker 

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



[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-20 Thread Vitaly

Vitaly added the comment:

The new name by itself does not sufficiently reflect the subtlety of 
element-by-element counts, which does a disservice to the readability of test 
code. And it's also an unnecessary incompatibility between 2.7 and 3.x.

--

___
Python tracker 

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



[issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7

2016-05-20 Thread Vitaly

Vitaly added the comment:

... and an unnecessary incompatibility between 2.7 and 3.x

--

___
Python tracker 

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



[issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7

2016-05-20 Thread Vitaly

Vitaly added the comment:

Yes, this caused me to examine Counter, which I had not used before, and now I 
understand it, too. However, the new name by itself does not sufficiently 
reflect the subtlety of element-by-element counts, which does a disservice to 
the readability of test code.

--

___
Python tracker 

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



[issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7

2016-05-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

It compares element by element counts, as indicated by "Equivalent to: 
assertEqual(Counter(list(first)), Counter(list(second))) ..." and the failure 
messages.  Since I understand Counter equality, I ignore the rest.

--
resolution:  -> not a bug
stage: test needed -> 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



[issue27071] unittest.TestCase.assertCountEqual is a very misleading name

2016-05-20 Thread Vitaly

New submission from Vitaly:

Somewhere in 3.x assertItemsEqual was renamed to assertCountEqual.

assertCountEqual sounds like a really inappropriate, misleading name for what 
it does. It misleads users into thinking that it only compares the number of 
elements in each sequence, whereas it actually asserts that equivalent items 
are present in both sequences, regardless of order. The original name from 2.7 
assertItemsEqual was so much more meaningful.

--
components: Library (Lib)
messages: 265980
nosy: vitaly
priority: normal
severity: normal
status: open
title: unittest.TestCase.assertCountEqual is a very misleading name
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3

2016-05-20 Thread Vitaly

Vitaly added the comment:

Folks, assertCountEqual sounds like a really bad name. It misleads users into 
thinking that it only compares the number of elements in each sequence, whereas 
it actually asserts that equivalent items are present in both sequences, 
regardless of order. The original name from 2.7 assertItemsEqual was so much 
better and more meaningful.

--

___
Python tracker 

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



[issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7

2016-05-20 Thread Vitaly

Vitaly added the comment:

I think that we can close this as not a bug, as concerning 2.7. However, I 
think that 3.x made the wrong decision when it renamed assertItemsEqual with 
assertCountEqual, which now misleads users into thinking that it compares 
counts.

--

___
Python tracker 

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



[issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7

2016-05-20 Thread Vitaly

Vitaly added the comment:

Thanks Terry, your assessment is correct. The maintainers appear to have drawn 
the wrong conclusion in #17866, which mislead me about the existing 
assertItemsEqual in 2.7, which appears to work correctly after all!

import unittest as u
class Test(u.TestCase):
def test_equal_count_of_same_elements(self):
self.assertItemsEqual([1,2,3], [1,2,3])

def test_equal_count_of_different_elements(self):
self.assertItemsEqual([1,2,3], [1,2,4])

def test_different_count(self):
self.assertItemsEqual([1,2,3], [1,2,3,4])
u.main()


$ python assert_items_equal_test.py --verbose
test_different_count (__main__.Test) ... FAIL
test_equal_count_of_different_elements (__main__.Test) ... FAIL
test_equal_count_of_same_elements (__main__.Test) ... ok

==
FAIL: test_different_count (__main__.Test)
--
Traceback (most recent call last):
  File "assert_items_equal_test.py", line 12, in test_different_count
self.assertItemsEqual([1,2,3], [1,2,3,4])
AssertionError: Element counts were not equal:
First has 0, Second has 1:  4

==
FAIL: test_equal_count_of_different_elements (__main__.Test)
--
Traceback (most recent call last):
  File "assert_items_equal_test.py", line 8, in 
test_equal_count_of_different_elements
self.assertItemsEqual([1,2,3], [1,2,4])
AssertionError: Element counts were not equal:
First has 1, Second has 0:  3
First has 0, Second has 1:  4

--
Ran 3 tests in 0.001s

FAILED (failures=2)

--

___
Python tracker 

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



[issue27070] Add ability to freeze (seal) mutable objects

2016-05-20 Thread Eric V. Smith

Eric V. Smith added the comment:

See the rejected PEP 351: https://www.python.org/dev/peps/pep-0351/

--
nosy: +eric.smith

___
Python tracker 

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



[issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7

2016-05-20 Thread Vitaly

Vitaly added the comment:

According to comment http://bugs.python.org/issue17866#msg188052 in #17866, the 
maintainers renamed `assertItemsEqual` to `assertCountEqual` somewhere in the 
3.x development timeframe. They apparently latched on to the implementation of 
`assertItemsEqual` in 2.7.x, which compares counts only, rather than its 
documentation.

--

___
Python tracker 

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



[issue27070] Add ability to freeze (seal) mutable objects

2016-05-20 Thread ppperry

ppperry added the comment:

Python is not the type of language in which one applies such memory 
micro-optimizations. In any case, if you really need to do this, use a custom 
class that subclasses `list` and overrides the modification methods to add a 
check.

--

___
Python tracker 

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



[issue27070] Add ability to freeze (seal) mutable objects

2016-05-20 Thread Марк Коренберг

Марк Коренберг added the comment:

making tuples (from lists), fronzensets(from sets) and bytes (from bytearray) 
requires memory copying. Especially for bytearrays.

--

___
Python tracker 

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



[issue27070] Add ability to freeze (seal) mutable objects

2016-05-20 Thread ppperry

ppperry added the comment:

Use tuples, frozensets, and bytes for the first three cases instead. I don't 
quite see what the benefit of this is. It seems arbitrarily restrictive.

--
nosy: +ppperry

___
Python tracker 

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



[issue27064] Make py.exe default to Python 3 when used interactively

2016-05-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

+1 By 'interactive use', I presume you mean at console command line
path\to\somewhere>py...

When I installed 3.4.4, I wondered if it would overwrite py with older version. 
 Great that 3.5.x does not.  I think each installer should have latest version 
of py.exe.  Really great if it could detect what version of py.exe is present, 
if any, and adjust option accordingly.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7

2016-05-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Here is the specific test code so you can replace my lists with examples that 
you think malfunction.

import unittest as u
class Test(u.TestCase):
def test_Count(self):
self.assertItemsEqual([1,2,3], [1,2,4])
u.main()

--

___
Python tracker 

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



[issue27060] Documentation of assertItemsEqual in unittest is VERY misleading in 2.7

2016-05-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Note: 2.7 doc says that this is renamed assertCountEqual in 3.x.  It was added 
in 2.7 and 3.2.  The 3.x doc is essentially the same, but with this instead: 
"Equivalent to: assertEqual(Counter(list(first)), Counter(list(second))) ...".

If the method misfunctions, then it should be fixed, not have the bug 
documented.  But you need to provide specific evidence and example.  The 
unittest in 3.x has this test with same number, different elements.
self.assertRaises(self.failureException, self.assertCountEqual,
  [1, 2] + [3] * 100, [1] * 100 + [2, 3])

I ran following test with same number, different items.
FAIL: test_Count (__main__.Test)
--
Traceback (most recent call last):
  File "F:\Python\mypy\tem.py", line 4, in test_Count
self.assertItemsEqual([1,2,3], [1,2,4])
AssertionError: Element counts were not equal:
First has 1, Second has 0:  3
First has 0, Second has 1:  4
 
This also fails in 3.5 with name change.

--
components: +Library (Lib) -Documentation
nosy: +terry.reedy
stage:  -> test needed
type:  -> behavior

___
Python tracker 

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



[issue26877] tarfile use wrong code when read from fileobj

2016-05-20 Thread Марк Коренберг

Марк Коренберг added the comment:

Can not reproduce in Linux. Will reopen if reproduced on MacOS X or BSD.

#!/usr/bin/python3.5

import os
import signal


p = os.getpid()

if os.fork() == 0:
while True:
try:
os.kill(p, signal.SIGCHLD)
except (ProcessLookupError, KeyboardInterrupt):
break
os._exit(0)

qwe = open('qwe.dat', 'w+b')
qwe.seek(2*1024*1024*1024*1024)
qwe.write(b'0')
qwe.flush()
qwe.seek(0)
while True:
d = qwe.read(65536 * 32)
if len(d) != 65536 * 32:
raise Exception('!')

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue16858] tarfile silently hides errors

2016-05-20 Thread Марк Коренберг

Марк Коренберг added the comment:

OOPS, closed wrong task, reopening.

--
resolution: wont fix -> 
status: closed -> open

___
Python tracker 

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



[issue16858] tarfile silently hides errors

2016-05-20 Thread Марк Коренберг

Марк Коренберг added the comment:

Can not reproduce in Linux. Will reopen if reproduced on MacOS X or BSD.

#!/usr/bin/python3.5

import os
import signal


p = os.getpid()

if os.fork() == 0:
while True:
try:
os.kill(p, signal.SIGCHLD)
except (ProcessLookupError, KeyboardInterrupt):
break
os._exit(0)

qwe = open('qwe.dat', 'w+b')
qwe.seek(2*1024*1024*1024*1024)
qwe.write(b'0')
qwe.flush()
qwe.seek(0)
while True:
d = qwe.read(65536 * 32)
if len(d) != 65536 * 32:
raise Exception('!')

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue27070] Add ability to freeze (seal) mutable objects

2016-05-20 Thread Марк Коренберг

New submission from Марк Коренберг:

I mean making mutable object immutable. I speak about List(), Set(), 
bytearray(), memoryview(), mmap() and so on.

bytearray already have `hold`, to lock size only, but it still not represented 
in Python.

--
components: Library (Lib)
messages: 265965
nosy: mmarkk
priority: normal
severity: normal
status: open
title: Add ability to freeze (seal) mutable objects
type: enhancement
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



[issue27064] Make py.exe default to Python 3 when used interactively

2016-05-20 Thread Zachary Ware

Zachary Ware added the comment:

I'm very much +1 on the patch.

A couple thoughts:
- Note that 2.7 doesn't come with a launcher.

- As I understand it, the 3.5+ installer won't overwrite a newer launcher than 
what it would install, but the 3.4- installer will.  So the only really 
confusing (to my mind) thing that could happen would be someone installing 3.4 
after 2.7 and 3.6, and the newly installed old 3.4 launcher reverts to 
defaulting to 2.x.  There's not much we can do about that, though: there will 
be no more 3.3 or 3.4 installers, so an update to the launcher in those 
branches would never see the light of day anyway.  I think this is an 
uncommon-enough situation that it can be ignored, but one possible way to work 
around it would be to install a pro-3 py.ini along with the launcher in 3.6+ 
(if it wouldn't be overwriting an existing py.ini).  Probably more effort than 
it's worth, though.

--

___
Python tracker 

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



[issue26865] Meta-issue: support of the android platform

2016-05-20 Thread Zachary Ware

Zachary Ware added the comment:

Xavier: It's been long enough that I don't remember whether regular Users can 
adjust Dependencies, but since you didn't do it yourself I assume they can't.  
I've just given you the Developer role, so you can now :)

--
nosy: +zach.ware

___
Python tracker 

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



[issue27067] Improve curses tests

2016-05-20 Thread Berker Peksag

Berker Peksag added the comment:

LGTM. I left some comments on Rietveld.

--
nosy: +berker.peksag
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



[issue27064] Make py.exe default to Python 3 when used interactively

2016-05-20 Thread Paul Moore

Paul Moore added the comment:

Thanks Ned. Personally, I'm still inclined *not* to add this to 2.7/3.5. People 
will get it when the install the 3.6 alphas, sure, but that seems to me to be a 
relatively obvious consequence of installing an alpha that includes a component 
that's used for all Python versions installed.

It seems to me that there will be the following categories of people:

1. No Python installed - this will just do the right thing (as would the old 
version).
2. Only 3.x installed - same as above.
3. Only 2.x installed - having the newly installed 3.6 become the default for 
the launcher seems like the expected behaviour.
4. Both 2.x and 3.x installed, and no py.ini setting the default - currently 
2.x will be the default, and it will switch to 3.6. This is basically the point 
of the change. And it's an easy fix to add a py.ini reverting the default to 
2.x.

People with a default set up in py.ini will be totally unaffected regardless.

To clarify things further for users in category (4), I've added a Misc/NEWS 
entry (which I should have done anyway) and an entry for "What's new".

As for the documentation using the term "latest Python version", I see what 
you're getting at, but I couldn't think of a better way of putting it without 
making the whole thing too convoluted for what is, after all, a pretty simple 
feature. (It's actually the *old* behaviour that's more complicated to 
describe). I'm happy to change it if someone can suggest a better wording, 
though.

--
Added file: http://bugs.python.org/file42918/launcher2.diff

___
Python tracker 

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



[issue27063] Some unittest loader tests are silently skipped by mistake

2016-05-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for review.

I found this when wrote patches for removing deprecated features.

--
resolution:  -> fixed
stage: commit 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



[issue27063] Some unittest loader tests are silently skipped by mistake

2016-05-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e715ffd2d938 by Serhiy Storchaka in branch '3.5':
Issue #27063: Some unittest loader tests were silently skipped.
https://hg.python.org/cpython/rev/e715ffd2d938

New changeset f4f615edb6b1 by Serhiy Storchaka in branch 'default':
Issue #27063: Some unittest loader tests were silently skipped.
https://hg.python.org/cpython/rev/f4f615edb6b1

--
nosy: +python-dev

___
Python tracker 

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



[issue27063] Some unittest loader tests are silently skipped by mistake

2016-05-20 Thread Robert Collins

Robert Collins added the comment:

LGTM too

--

___
Python tracker 

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



[issue27063] Some unittest loader tests are silently skipped by mistake

2016-05-20 Thread Berker Peksag

Berker Peksag added the comment:

LGTM. Just curious, did you find it by reading code or by using some tool?

--
nosy: +berker.peksag
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



[issue27064] Make py.exe default to Python 3 when used interactively

2016-05-20 Thread Ned Deily

Ned Deily added the comment:

I don't have a strong opinion one way on the matter since I don't have any 
experience with the launcher.  I think I understand the issue of the Windows 
installer providing "release-independent" components (and, FTR, the OS X 
installer has a somewhat similar issue although the launcher there is believed 
to not be used much at all).  Whether we should change the defaults for future 
releases of 2.7.x and/or 3.5.x is probably ultimately up to the 2.7 and 3.6 
release managers though I expect they would go along with whatever you all 
recommend.  If it does make sense to modify py.exe for 2.7.x and 3.5.x, then 
perhaps the corresponding change for 3.6 could be deferred until after 2.7.11 
and 3.5.2 are released, which should be before 3.6.0a3, and all have consistent 
documentation of the changed behavior?  It's not perfect but at least all of 
the most recent binary releases would be consistent.

A somewhat unrelated comment on the patch:  will it be clear to users what is 
meant by "latest version installed"?  That is, what is meant by "latest 
version" in each of these cases: (scenario 1) install 2.7. then 3.5, then 3.6'; 
(scenario 2) install 3.5, 3.6, then 2.7; (scenario 3) install 3.6, 3.5, then 
2.7; (scenario 4) install 3.6, 2.7, then 3.5.

--

___
Python tracker 

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



[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-05-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your review Martin.

--
resolution:  -> fixed
stage: commit 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



[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-05-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4e605f809551 by Serhiy Storchaka in branch '3.5':
Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"
https://hg.python.org/cpython/rev/4e605f809551

New changeset 0285173d81b4 by Serhiy Storchaka in branch '2.7':
Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"
https://hg.python.org/cpython/rev/0285173d81b4

New changeset 03b32f854680 by Serhiy Storchaka in branch 'default':
Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"
https://hg.python.org/cpython/rev/03b32f854680

--
nosy: +python-dev

___
Python tracker 

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



[issue27056] pickle: constant propagation in _Unpickler_Read()

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka:
> I think that integer overflow in _Unpickler_Read() is possible. n is read 
> from file and can be arbitrary (up to PY_SSIZE_T_MAX). This likely cause 
> raising an exception later, but integer overflow itself causes undefined 
> behavior, and we should avoid it.

Hum, I understood that it's ok since numbers should be signed, but in
fact I'm not confident that n is always signed. You are right, it's
better to use your code to avoid the integer overflow. I pushed a fix.

--

___
Python tracker 

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



[issue27056] pickle: constant propagation in _Unpickler_Read()

2016-05-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3d7b7aa89437 by Victor Stinner in branch 'default':
Issue #27056: Fix _Unpickler_Read() to avoid integer overflow
https://hg.python.org/cpython/rev/3d7b7aa89437

--

___
Python tracker 

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



[issue24712] Docs page's sidebar vibrates on mouse wheel scroll on Chrome.

2016-05-20 Thread Mike Taylor

Mike Taylor added the comment:

The bug for Chrome to ship support of position: sticky is here: 
https://bugs.chromium.org/p/chromium/issues/detail?id=231752 -- it's in active 
development.

But this patch fixes the jerky sidebar in Firefox as well.

--

___
Python tracker 

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



[issue24712] Docs page's sidebar vibrates on mouse wheel scroll on Chrome.

2016-05-20 Thread Mike Taylor

Mike Taylor added the comment:

OK, so uh, somehow a few months escaped me before I could get to this. >_>

(I've also just signed the Contributor Agreement with the PSF)

--
keywords: +patch
Added file: http://bugs.python.org/file42917/docs-sidebar.patch

___
Python tracker 

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



[issue9517] Make test.script_helper more comprehensive, and use it in the test suite

2016-05-20 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue27064] Make py.exe default to Python 3 when used interactively

2016-05-20 Thread Paul Moore

Paul Moore added the comment:

Because of the nature of the launcher, there's not much we can do about that 
IMO. And there was no real objection to changing the default on the 
python-ideas thread (at least for interactive use).

But I'll wait to see if Ned has anything to add.

--

___
Python tracker 

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



[issue9517] Make test.script_helper more comprehensive, and use it in the test suite

2016-05-20 Thread Berker Peksag

Changes by Berker Peksag :


--
dependencies: +Update test_base64 to use test.support.script_helper, Update 
test_capi to use test.support.script_helper

___
Python tracker 

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



[issue24398] Update test_capi to use test.support.script_helper

2016-05-20 Thread Berker Peksag

Changes by Berker Peksag :


--
components: +Tests
keywords: +easy
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

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



[issue27064] Make py.exe default to Python 3 when used interactively

2016-05-20 Thread Steve Dower

Steve Dower added the comment:

It'll change their default behavior if they get an alpha release of 3.6 though, 
and uninstalling the alpha won't revert it.

That said, I don't really feel like the launcher is an "alpha" product, even if 
the core Python engine is in that state. Possibly the RM has an opinion here?

--
nosy: +ned.deily

___
Python tracker 

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



[issue25533] Make pkgutil.iter_modules() yield built-in modules

2016-05-20 Thread Martin Panter

Martin Panter added the comment:

iter-builtins-flag.patch has support for built-in modules via the builtins=True 
flag, but I removed the support for frozen modules.

--
stage:  -> patch review
Added file: http://bugs.python.org/file42916/iter-builtins-flag.patch

___
Python tracker 

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



[issue27069] webbrowser creates zombi processes in the background mode

2016-05-20 Thread Martin Panter

Martin Panter added the comment:

I think the Firefox command will exit immediately if it just signals an 
existing Firefox process and window, but becomes the main Firefox process if 
there isn’t already one running.

Background = False sounds like it won’t help. Don’t we want the opposite?

--

___
Python tracker 

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



[issue27056] pickle: constant propagation in _Unpickler_Read()

2016-05-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think that integer overflow in _Unpickler_Read() is possible. n is read from 
file and can be arbitrary (up to PY_SSIZE_T_MAX). This likely cause raising an 
exception later, but integer overflow itself causes undefined behavior, and we 
should avoid it.

--

___
Python tracker 

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



[issue27069] webbrowser creates zombi processes in the background mode

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

I checked how "xdg-open http://www.python.org/; works. It looks like the 
command works as webbrowser: create a child process "firefox URL", but then it 
waits until the command completes.

In fact, "firefox URL" exits quickly. So we can try "background = False" for 
firefox. Well, at least with my Firefox 46.0.1.

--

___
Python tracker 

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



[issue27068] Add a detach() method to subprocess.Popen

2016-05-20 Thread Martin Panter

Martin Panter added the comment:

In this example, I think we want to drop the zombie so the “init” process will 
call wait() on it. My pseudocode is similar to your fork() suggestion in Issue 
27069. Fork returns the child’s PID, but we would ignore the PID and exit the 
intermediate parent process instead.

--

___
Python tracker 

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



[issue27068] Add a detach() method to subprocess.Popen

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

Martin Panter:
> One potential way to fix Issue 27069 (leave a webbrowser running in the 
> background) might be to use a detach() method. Pseudocode:

Your code is a workaround to hide the warning, it doesn't fix the bug
(creating a zombi process).

--

___
Python tracker 

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



[issue27068] Add a detach() method to subprocess.Popen

2016-05-20 Thread Martin Panter

Martin Panter added the comment:

One potential way to fix Issue 27069 (leave a webbrowser running in the 
background) might be to use a detach() method. Pseudocode:

launcher = """\
import subprocess, sys
proc = subprocess.Popen(sys.argv)

# Popen object gives up “ownership” of child.
# Caller exits straight afterwards, letting the OS take care of monitoring the 
child.
proc.detach()
"""

def open_firefox(url):
cmd = (sys.executable, "-c", launcher, "firefox", url)
subprocess.check_call(cmd)

--

___
Python tracker 

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

> At this point, the Python interpreter has a child process “chromium” which is 
> left as a zombie when it exits.

The new ResourceWarning is the confirmation that there is an issue. Creating a 
zombi process is not a good idea :-)

I opened the issue #27069 to fix this bug.

--

___
Python tracker 

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



[issue27069] webbrowser creates zombi processes in the background mode

2016-05-20 Thread STINNER Victor

New submission from STINNER Victor:

The webbrowser opens almost all browsers in background mode, it looks like only 
Elinks is not opened in this mode.

Problem: the webbrowser doesn't read the exit status of the browser, and so 
create zombi process. On Python 3.6, the subprocess module now emits a 
ResourceWarning in this case (issue #26741).

For example, the following script shows a zombi process (""):
---
import webbrowser, os

b = webbrowser.get("firefox")
b.open("https://bugs.python.org/issue26741;)
b = None

os.system("ps ax|grep firefox")
input("press ENTER when firefox exited")
os.system("ps ax|grep firefox")
---

I guess that Python should use os.fork() somehow to fix this issue.

Another option is to hack the Popen object to not display the warning, but I 
don't think that it's a safe option.

See also the issue #27068 "Add a detach() method to subprocess.Popen", but I 
don't think that it is directly related to background processes run by 
webbrowser.

--
messages: 265939
nosy: haypo, martin.panter
priority: normal
severity: normal
status: open
title: webbrowser creates zombi processes in the background mode
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-05-20 Thread Martin Panter

Martin Panter added the comment:

I tried out your code on the webbrowser module, and it does raise a warning:

>>> import webbrowser
>>> b = webbrowser.get("chromium")
>>> b.open("https://bugs.python.org/issue26741;)
/home/proj/python/cpython/Lib/subprocess.py:1011: ResourceWarning: running 
subprocess 
  source=self)
True

At this point, the Python interpreter has a child process “chromium” which is 
left as a zombie when it exits. I guess the easiest solution (at least for 
Unix) would be to spawn an intermediate launcher process that exited after 
launching the web browser process.

--

___
Python tracker 

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



[issue26814] [WIP] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

> unpickle_list: 1.11x faster

This result was unfair: my fastcall branch contained the optimization of the 
issue #27056. I just pushed this optimization into the default branch.

I ran again the benchmark: the result is now "not significant", as expected, 
since the benchmark is a microbenchmark testing C functions of 
Modules/_pickle.c, it doesn't really rely on the performance of (C or Python) 
functions calls.

--

___
Python tracker 

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-05-20 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue26970] Replace OpenSSL's CPRNG with system entropy source

2016-05-20 Thread Christian Heimes

Christian Heimes added the comment:

My remark was ambiguous. I meant that I have to create an second implementation 
of _PyOS_URandom and use it in _ssl_osrandom_bytes.

Let's discuss the details on IRC after PyCon. I'm busy with preparations.

--

___
Python tracker 

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



[issue25285] regrtest: run tests in subprocesses with -j1 on buildbots

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

changeset:   101449:6f7e5b51c8fb
user:Victor Stinner 
date:Fri May 20 13:15:55 2016 +0200
files:   Lib/test/libregrtest/cmdline.py Misc/NEWS Tools/buildbot/test.bat
description:
regrtest doesn't ignore -j1 anymore

* regrtest now uses subprocesses when the -j1 command line option
  is used: each test file runs in a fresh child process. Before, the -j1 option
  was ignored.
* Tools/buildbot/test.bat script now uses -j1 by default to run
  each test file in fresh child process.

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



[issue27068] Add a detach() method to subprocess.Popen

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

Hum, I had to patch asyncio to avoid a ResourceWarning because asyncio polls 
the status of the child process using a child watcher, whereas the Popen object 
is not aware of the child watcher:

New changeset 72946937536e by Victor Stinner in branch '3.5':
asyncio: fix ResourceWarning related to subprocesses
https://hg.python.org/cpython/rev/72946937536e

The asyncio child watcher uses os.waitpid() on a specific pid or wait for the 
exit of any child process depending on the chosen implemetation. The fast 
watcher implementations uses a signal handler on the signal SIGCHLD.

--

___
Python tracker 

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-05-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 72946937536e by Victor Stinner in branch '3.5':
asyncio: fix ResourceWarning related to subprocesses
https://hg.python.org/cpython/rev/72946937536e

New changeset 911f398c6396 by Victor Stinner in branch 'default':
Merge 3.5 (issue #26741)
https://hg.python.org/cpython/rev/911f398c6396

--

___
Python tracker 

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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

Nathaniel, Antoine: ping again? No reaction to the new shiny C API of 
tracemalloc that *you* requested? :-p

--

___
Python tracker 

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

Martin Panter:
> I think the basic idea of adding the warning is good.

Cool.

I pushed an enhanced version of my patch:

* I fixed _execute_child() to set correctly the returncode attribute
* I splitted the patch into multiple commits and I documented the doc
* I fixed test_subprocess on Windows


Me:
> TODO: fix also the Windows implementation of _execute_child().

subprocess.py on Windows is correct, but I had to fix more unit tests specific 
to Windows in test_subproces.py.


Martin Panter:
> One potential problem is how to provide for people who really want to let the 
> child continue to run in the background or as a daemon without waiting for 
> it, even if the parent exits. Perhaps a special method proc.detach() or 
> whatever?

While I'm not convinced that the use case exists nor that it's safe to delegate 
the management of the subprocess to a different object after the Popen object 
is destroyed, I opened the issue #27068 to discuss this feature enhancement.

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-05-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b122011b139e by Victor Stinner in branch 'default':
Use "with popen:" in test_subprocess
https://hg.python.org/cpython/rev/b122011b139e

New changeset 4c02b983bd5f by Victor Stinner in branch 'default':
Issue #26741: POSIX implementation of subprocess.Popen._execute_child() now
https://hg.python.org/cpython/rev/4c02b983bd5f

New changeset b7f3494deb2c by Victor Stinner in branch 'default':
subprocess now emits a ResourceWarning warning
https://hg.python.org/cpython/rev/b7f3494deb2c

--
nosy: +python-dev

___
Python tracker 

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



[issue27068] Add a detach() method to subprocess.Popen

2016-05-20 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +martin.panter

___
Python tracker 

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



[issue27068] Add a detach() method to subprocess.Popen

2016-05-20 Thread STINNER Victor

New submission from STINNER Victor:

The issue #26741 modified the subprocess.Popen destructor to emit a 
ResourceWarning if the child process is still running.

According to Martin Panter, it can be deliberate to let the subprocess running 
if the management of the subprocess is delegated to a different object. I'm not 
convinced that it's safe to do that, but I chose to open this issue to discuss 
the feature.

My fear is that subprocess.Popen handles many private objects required by the 
subprocess, not only its pid. For example, on Windows Popen stores the handle 
of the subprocess. Popen also contains pipe objects when stdin, stdout and/or 
stderr is redirected.

I guess that detach() makes sense when the developer knows what he/she is doing 
and knows how to handle all resources attached to a subprocess.

--
components: Library (Lib)
messages: 265929
nosy: haypo
priority: normal
severity: normal
status: open
title: Add a detach() method to subprocess.Popen
type: enhancement
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



[issue26858] android: setting SO_REUSEPORT fails

2016-05-20 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Should use boolean 'is_android' being added to module test.support by issue 
#27027, instead of platform.android_ver()[0].

--

___
Python tracker 

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



[issue26850] PyMem_RawMalloc(): update also sys.getallocatedblocks() in debug mode

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

I'm not convinced myself by this change, it may make detection of memory leaks 
much more tricky for a little gain. I prefer to reject my own issue ;-)

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue27056] pickle: constant propagation in _Unpickler_Read()

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka: "I forgot to note that the comment before _Unpickler_Read() 
becomes not correct, but you already addressed this in the second patch. 
unpickle_read-2.patch LGTM."

Cool, pushed.

"Few months ago I tried to optimize reading in pickle, but didn't see 
significant benefit. After committing your patch I'm going to revive my patch."

Cool too, keep me in touch.

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



[issue27056] pickle: constant propagation in _Unpickler_Read()

2016-05-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f9b85b47f9c8 by Victor Stinner in branch 'default':
Optimize pickle.load() and pickle.loads()
https://hg.python.org/cpython/rev/f9b85b47f9c8

--
nosy: +python-dev

___
Python tracker 

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



[issue26931] android: test_distutils fails

2016-05-20 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This new patch adds a dependency to issue #27027.

--
Added file: http://bugs.python.org/file42915/android-sh-path_2.patch

___
Python tracker 

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



[issue26948] Simplify PyImport_ImportModuleLevelObject: avoid temporary tuple of str.partition/rpartition

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

I modified my patch to address Serhiy's comments. Thanks for the your review 
Serhiy.

changeset:   101442:779563dd701c
tag: tip
user:Victor Stinner 
date:Fri May 20 11:36:13 2016 +0200
files:   Python/import.c
description:
Cleanup import.c

* Replace PyUnicode_RPartition() with PyUnicode_FindChar() and
  PyUnicode_Substring() to avoid the creation of a temporary tuple.
* Use PyUnicode_FromFormat() to build a string and avoid the single_dot ('.')
  singleton

Thanks Serhiy Storchaka for your review.

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



[issue27056] pickle: constant propagation in _Unpickler_Read()

2016-05-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I forgot to note that the comment before _Unpickler_Read() becomes not correct, 
but you already addressed this in the second patch. unpickle_read-2.patch LGTM.

Few months ago I tried to optimize reading in pickle, but didn't see 
significant benefit. After committing your patch I'm going to revive my patch.

--
assignee:  -> haypo
stage:  -> commit review

___
Python tracker 

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



[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-20 Thread Ben Spiller

Ben Spiller added the comment:

Thanks for considering this, anyway. I'll admit I'm disappointed we couldn't 
fix this on the 2.7 train, as to me fixing a method that takes an 
errors='ignore' argument and then throws an exception anyway seems a little 
more like a bug than a feature (and changing it would likely not affect 
behaviour in any existing non-broken programs), but if that's the decision then 
fine. Of course I'm aware (as I mentioned earlier on the thread) that the 
radically different unicode handling in python 3 solves this entirely and only 
wish it was practical to move our existing (enormous) codebase and customers 
over to it, but we're stuck with Python 2.7 - I believe lots of people are in 
the same situation unfortunately. 

As Josh suggested, perhaps we can at least add something to the doc for the 
str/unicode encode and decode methods so users are aware of the behaviour 
without trial and error. I'll update the component of this bug to reflect it's 
now considered a doc issue. 

Based on the inputs from Terry, and what seem to be the key info that would 
have been helpful to me and those who are hitting the same issues for the first 
time, I'd propose the following text (feel free to adjust as you see fit):

For encode:
"For most encodings, the return type is a byte str regardless of whether it is 
called on a str or unicode object. For example, call encode on a unicode object 
with "utf-8" to return a byte str object, or call encode on a str object with 
"base64" to return a base64-encoded str object.

It is _not_ recommended to use call this method on "str" objects when using 
codecs such as utf-8 that convert betweens str and unicode objects, as any 
characters not supported by python's default encoding (usually 7-bit ascii) 
will result in a UnicodeDecodeError exception, even if errors='ignore' was 
specified. For such conversions the str.decode and unicode.encode methods 
should be used. If you need to produce an encoded version of a string that 
could be either a str or unicode object, only call the encode() method after 
checking it is a unicode object not a str object, using isinstance(s, unicode)."

and for decode:
"The return type may be either str or unicode, depending on which encoding is 
used and whether the method is called on a str or unicode object. For example, 
call decode on a str object with "utf-8" to return a unicode object, or call 
decode on a unicode or str object with "base64" to return a base64-decoded str 
object.

It is _not_ recommended to use call this method on "unicode" objects when using 
codecs such as utf-8 that convert betweens str and unicode objects, as any 
characters not supported by python's default encoding (usually 7-bit ascii) 
will result in a UnicodeEncodeError exception, even if errors='ignore' was 
specified. For such conversions the str.decode and unicode.encode methods 
should be used. If you need to produce a decoded version of a string that could 
be either a str or unicode object, only call the decode() method after checking 
it is a str object not a unicode object, using isinstance(s, str)."

--
components: +Documentation -Interpreter Core

___
Python tracker 

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



[issue19695] Clarify how to use various import-related locks

2016-05-20 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue27056] pickle: constant propagation in _Unpickler_Read()

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

Updated patch 2 to address Serhiy's comments.

--
Added file: http://bugs.python.org/file42914/unpickle_read-2.patch

___
Python tracker 

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



[issue26856] android does not have pwd.getpwall()

2016-05-20 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This new patch adds a dependency to issue #27027.

--
Added file: http://bugs.python.org/file42913/pwd_2.patch

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-05-20 Thread STINNER Victor

STINNER Victor added the comment:

I regenerated wpy8.patch with Mercurial. I had to fix a minor conflict in 
Lib/importlib/_bootstrap_external.py. (I didn't read the patch.)

--

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-05-20 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file42912/wpy8.patch

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-05-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added new comments on Rietveld.

--
stage:  -> patch review

___
Python tracker 

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



[issue26919] android: test_cmd_line fails

2016-05-20 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This new patch adds a dependency to issue #27027.

--
Added file: http://bugs.python.org/file42911/retrofit_osx_3.patch

___
Python tracker 

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



[issue27027] add is_android in test.support to detect Android platform

2016-05-20 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The patch adds a dependency to issue #26855.

--
keywords: +patch
Added file: http://bugs.python.org/file42910/is_android.patch

___
Python tracker 

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



[issue27067] Improve curses tests

2016-05-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch improves curses tests. Main improvements are:

* Tests now run even if sys.stdout is not terminal.
* The screen is not spoiled during tests.
* Reported the name and arguments of failed function.
* Testing optional functionality is extracted in separated tests. They are 
reported as skipped if optional functions are not available.

--
components: Tests
files: test_curses_2.patch
keywords: patch
messages: 265914
nosy: serhiy.storchaka, twouters, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Improve curses tests
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42909/test_curses_2.patch

___
Python tracker 

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



[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-20 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Ben, the methods on stings and Unicode objects in Python 2.x are direct 
interfaces to the underlying codecs. The codecs can handle any number of input 
and output types, so there are some which only work on 8-bit strings (bytes) 
and others which take Unicode as input.

As a result, you sometimes see errors due to the conversion of an 8-bit string 
to Unicode (in the case, where the codec expects a Unicode input).

As example, take the UTF-8 codec. This expects a Unicode input when decoding, 
so when you pass in an 8-bit string, Python will convert this to Unicode using 
the default encoding (which is normally set to 'ascii') and then applies the 
codec operation.

When the 8-bit string is plain ASCII this works great. If not, chances are high 
that you'll run into a Unicode error.

Now, in Python 2.x you can change the default encoding to either make this work 
by assuming that all your 8-bit strings are UTF-8 (set it to 'utf-8' in 
sitecustomize.py), or you can disable the automatic conversion altogether by 
setting the default encoding to 'unknown', which is a codec specifically 
created for this purpose. The latter will also raise an exception when 
attempting to convert an 8-bit string to Unicode - similar to what Python 3 
does, except that the error type is different.

Hope that helps.

--
nosy: +lemburg

___
Python tracker 

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



[issue27064] Make py.exe default to Python 3 when used interactively

2016-05-20 Thread Paul Moore

Paul Moore added the comment:

Thanks Steve. I wasn't sure over versioning, which is why I decided to be 
conservative. Also, it's probably not good to change the default behaviour on 
people when they just install a patch release of 3.5.

--

___
Python tracker 

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



[issue26632] __all__ decorator

2016-05-20 Thread Franklin? Lee

Franklin? Lee added the comment:

I like how ``@public`` keeps the declaration close to the definition.

I am iffy about using ``public`` to define other values. That part might be 
considered unpythonic.


Implementation issues:
- ``__module__`` is not reliable. ``functools.wraps`` changes it. (Why does 
it do that, though?)
- If `__all__` isn't a list, you'd have to make it a list before you mess 
with it. (Is this possible?)


> > On the down side, you know somebody is going to @public a class' method --
> > how do we check for that?
>
> Do we need to?  Consenting adults and __all__.

It's a silent error waiting to happen. If you never use ``import *`` on it 
(e.g. because it's your main file), you won't get the error message. Things 
will work "as expected" (your methods are class-public!) until you give a 
method the same name as a builtin or something you imported or defined earlier. 
When that happens, the error message will have nothing to do with the problem.

It might be detectable using ``thing.__qualname__ != thing.__name__``, but this 
disallows functions decorated without updating __qualname__, and static/class 
methods exposed in a module's interface.

It might be detectable by checking, on the callstack, whether you're in a 
module load or a class definition.


Bikeshed



How many public module values aren't enum-type constants? It could be useful to 
be able to dump an enum into a module's space. I mean, a canonical way. With 
that, maybe maintaining module-level constants in __all__ isn't that big a deal.

# Rather than:
globals().update(MyEnum.__members__)
__all__.extend(MyEnum.__members__)
# Perhaps allow:
enum.dump_namespace(MyEnum, globals())


About the cost paid at every load:
- Should tools update __all__ for you, and comment out the ``@public``s?
- If so, how would they deal with public non-callable values?
- When compiling to .pyc, should the compiler remove ``@public`` calls and 
explicitly add the values to __all__?


API:
- Alternative syntax for constants, requiring less frame hackery:
public(globals(), x=1, y=2, z=3)
- Naming: Is it really "public"? Some names might be public but not in 
__all__.


P.S. Typo in the ReadTheDocs. ``py_install`` should be a function call, right?

>>> from public import py_install
>>> py_install


P.S.: Would OrderedSet (which doesn't exist) be the ideal type for __all__? I 
mean, if you had to use someone else's __all__, not if you had to maintain it.

--
nosy: +leewz

___
Python tracker 

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



[issue26632] __all__ decorator

2016-05-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy:  -serhiy.storchaka

___
Python tracker 

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



[issue26632] __all__ decorator

2016-05-20 Thread Berker Peksag

Berker Peksag added the comment:

+1 for the idea. I saw a lot of different 'all' or 'public' decorators in the 
wild. It would be nice to have a complete solution in Python. It would be good 
to add a note to Doc/whatsnew/3.6.rst.

--
components: +Interpreter Core
nosy: +berker.peksag
stage:  -> patch review
type:  -> enhancement

___
Python tracker 

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



[issue27065] robotparser user agent considered hostile by mod_security rules.

2016-05-20 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report. This is a duplicate of issue 15851.

--
nosy: +berker.peksag
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Lib/robotparser.py doesn't accept setting a user agent string, 
instead it uses the default.

___
Python tracker 

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