[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-01 Thread Madhav Datt

New submission from Madhav Datt:

The problem is described with an example in this StackOverflow question 
(https://stackoverflow.com/questions/26589805/python-enums-across-modules). 
Like in C and other languages, I would expect Enum equality to work across 
modules and not compare enum states/values, instead of just checking for the 
same object.

A possible simple fix for this problem would be to override the __eq__() 
function by default in the enum.Enum class with the following:

def __eq__(self, other):
if isinstance(other, self.__class__):
return self.value == other.value
return False

I would be happy to create a GitHub pull request to fix this, however, I do not 
have the experience or knowledge to know if
- the current behavior is by design;
- whether this is worth fixing; and
- whether fixing this will break anything else.

--
components: Library (Lib)
messages: 294983
nosy: Madhav Datt
priority: normal
severity: normal
status: open
title: Enum equality across modules: comparing objects instead of values
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue30052] URL Quoting page links to function Bytes instead of defintion

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 1c92c0edca413c6f8ce8ec326a67451ae751ead9 by Mariatta in branch 
'3.6':
bpo-30052: Link `bytes` & `bytearray` to stdtypes not functions  (GH-1271) 
(GH-1915)
https://github.com/python/cpython/commit/1c92c0edca413c6f8ce8ec326a67451ae751ead9


--
nosy: +Mariatta

___
Python tracker 

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



[issue30303] IDLE: Add _utest to textview and add textview tests

2017-06-01 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1996

___
Python tracker 

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



[issue30052] URL Quoting page links to function Bytes instead of defintion

2017-06-01 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1995

___
Python tracker 

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



[issue29514] Add a test case that prevents magic number changes in minor releases

2017-06-01 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage: patch review -> backport needed

___
Python tracker 

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



[issue30392] default webbrowser fails on macOS Sierra 10.12.5

2017-06-01 Thread Kevin Ballard

Kevin Ballard added the comment:

There is a potential workaround that could be used so that way macOS 10.12.5 
works. It turns out that, with osascript, if you catch the error and try again, 
it works.

$ osascript < try
> open location "http://apple.com;
> on error
> open location "http://apple.com;
> end try
> EOF

--
nosy: +Kevin Ballard
status: pending -> open

___
Python tracker 

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



[issue21783] smtpd.py does not allow multiple helo/ehlo commands

2017-06-01 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

I don't have much interest in working on this for smtpd.py any more.  We have 
an asyncio-based version that's much better, albeit Python 3 only.

https://github.com/aio-libs/aiosmtpd

This same issue is open over there; if you're still interested in this, maybe 
take a look at contributing a fix for aiosmtpd.

https://github.com/aio-libs/aiosmtpd/issues/78

--

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset cca3d4aa25a7aea0cda90dd2aa012f58c85e7e24 by Mariatta (Matthias 
Bussonnier) in branch '3.5':
bpo-29660: traceback: Document that etype is ignored in some places. (GH-344) 
(GH-1914)
https://github.com/python/cpython/commit/cca3d4aa25a7aea0cda90dd2aa012f58c85e7e24


--

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks :)

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset e417d12d728103445b8516a35f643536e401f120 by Mariatta (Matthias 
Bussonnier) in branch '3.6':
bpo-29660: traceback: Document that etype is ignored in some places. (GH-344) 
(GH-1913)
https://github.com/python/cpython/commit/e417d12d728103445b8516a35f643536e401f120


--

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Matthias Bussonnier

Changes by Matthias Bussonnier :


--
pull_requests: +1994

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Matthias Bussonnier

Changes by Matthias Bussonnier :


--
pull_requests: +1993

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

Thanks @Mariatta, I'll try to cherry-pick!

--

___
Python tracker 

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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-01 Thread Segev Finer

Changes by Segev Finer :


--
pull_requests: +1992

___
Python tracker 

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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-01 Thread Segev Finer

New submission from Segev Finer:

Found due to this: https://github.com/pytest-dev/py/issues/103

I'm going to submit a PR.

--
components: IO, Windows
messages: 294975
nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW 
fails
versions: 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



[issue25324] Importing tokenize modifies token

2017-06-01 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1991

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks Matthias.

I can backport this later today.
Or do you want to do it? :)
You can use cherry_picker.py 
https://github.com/python/core-workflow/tree/master/cherry_picker

--

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage: patch review -> backport needed

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset cdb89cd72cbc66e4626914b4a71b9052ddb3a32a by Mariatta (Matthias 
Bussonnier) in branch 'master':
bpo-29660: traceback: Document that etype is ignored in some places. (GH-344)
https://github.com/python/cpython/commit/cdb89cd72cbc66e4626914b4a71b9052ddb3a32a


--
nosy: +Mariatta

___
Python tracker 

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



[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-01 Thread Eric N. Vander Weele

Changes by Eric N. Vander Weele :


--
nosy: +ericvw

___
Python tracker 

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



[issue30543] test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: ConnectionResetError: [Errno 54] Connection reset by peer

2017-06-01 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +buildbot

___
Python tracker 

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



[issue30543] test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: ConnectionResetError: [Errno 54] Connection reset by peer

2017-06-01 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%203.x/builds/350/steps/test/logs/stdio

testAcceptTimeout (test.test_timeout.TCPTimeoutTestCase) ... ok
testConnectTimeout (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 
'blackhole.snakebite.net' is not available"
testRecvTimeout (test.test_timeout.TCPTimeoutTestCase) ... ok
testSend (test.test_timeout.TCPTimeoutTestCase) ... ERROR
testSendall (test.test_timeout.TCPTimeoutTestCase) ... ok
testSendto (test.test_timeout.TCPTimeoutTestCase) ... ERROR
testRecvfromTimeout (test.test_timeout.UDPTimeoutTestCase) ... test 
test_timeout failed
ok

==
ERROR: testSend (test.test_timeout.TCPTimeoutTestCase)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_timeout.py",
 line 151, in tearDown
self.sock.close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
417, in close
self._real_close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
411, in _real_close
_ss.close(self)
ConnectionResetError: [Errno 54] Connection reset by peer

==
ERROR: testSendto (test.test_timeout.TCPTimeoutTestCase)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_timeout.py",
 line 151, in tearDown
self.sock.close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
417, in close
self._real_close()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 
411, in _real_close
_ss.close(self)
ConnectionResetError: [Errno 54] Connection reset by peer

--
Ran 14 tests in 10.084s

FAILED (errors=2, skipped=1)
1 test failed again:
test_timeout

Total duration: 17 min 14 sec
Tests result: FAILURE

--
components: Tests
messages: 294971
nosy: haypo
priority: normal
severity: normal
status: open
title: test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: 
ConnectionResetError: [Errno 54] Connection reset by peer
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



[issue30177] pathlib.resolve(strict=False) only includes first child

2017-06-01 Thread Antoine Pietri

Antoine Pietri added the comment:

So, I asked a friend to check again with a more recent Python version on 
Windows and he can't reproduce the documented behavior, so the bug seems to 
also be present on Windows. My patch doesn't address that for now, which 
explains why the build fails (and why it was working before).

--

___
Python tracker 

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



[issue25324] Importing tokenize modifies token

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

Albert-Jan Nijburg added the comment:
> Aah! Oops I can fix later today.

Don't worry. Our test suite and all reviewers also missed it ;-)

--

___
Python tracker 

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



[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-01 Thread Mario Corchero

Mario Corchero added the comment:

Sample implementation using the new class:
https://github.com/mariocj89/cpython/commit/2f13963159e239de041cd68273b9fc4a2aa778cd

Sample implementation using the new function to seal existing mocks:
https://github.com/mariocj89/cpython/commit/9ba039e3996f4bf357d4827123e0b570d84f5bb6

Happy to submit a PR if the idea is accepted.

The only benefit I see from the using a separate class is that you will be able 
to do:

>>> m = mock.SealedMock()
>>> m.important_attr = 42
>>> m.freeflow_attribute = mock.Mock()
>>> mock.seal(m)

which will allow to define "subparts of the mock" without the sealing.

That said I still prefer the function implementation as it looks much nicer 
(credit to Victor Stinner for the idea)

--

___
Python tracker 

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



[issue22393] multiprocessing.Pool shouldn't hang forever if a worker process dies unexpectedly

2017-06-01 Thread Francis Bolduc

Francis Bolduc added the comment:

This problem also happens simply by calling sys.exit from one of the child 
processes.

The following script exhibits the problem:

import multiprocessing
import sys
def test(value):
if value:
sys.exit(123)
if __name__ == '__main__':
pool = multiprocessing.Pool(4)
cases = [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
pool.map(test, cases)

--
nosy: +Francis Bolduc

___
Python tracker 

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



[issue30535] Warn that meta_path is not empty

2017-06-01 Thread Brett Cannon

Brett Cannon added the comment:

I'm fine with adding a note to the Python 2 docs, but putting it in Python 3 
seems to be going in the wrong direction as having sys.meta_path not be empty 
is how Python will be going forward.

--

___
Python tracker 

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



[issue25324] Importing tokenize modifies token

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset c9ccacea3ff441b1ff519c7399602b7db16f9783 by Mariatta (Albert-Jan 
Nijburg) in branch 'master':
bpo-25324: add missing comma in Parser/tokenizer.c (GH-1910)
https://github.com/python/cpython/commit/c9ccacea3ff441b1ff519c7399602b7db16f9783


--
nosy: +Mariatta

___
Python tracker 

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



[issue29512] regrtest refleak: implement bisection feature

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

The next step is to add a command to regrtest implementing all steps. Or maybe 
this script is enough? At least, it's enough for my needs ;-)

--

___
Python tracker 

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



[issue29512] regrtest refleak: implement bisection feature

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy: "I don't understand how issue30523 and issue30540 can help to resolve 
this issue."

- issue30523 produces a list of all test methods
- issue30540 allows to pass a file to filter tests
- attached bisect_test.py takes an input file produced by --list-tests and uses 
--matchfile to run tests

Example of usage:

./python bisect_test.py test_tools tests bisect -n 5 

* bisect -R 3:3 on test_tools
* tests contains the list of test identifiers to test_tools
* write result into the file "bisect"
* stop bisection when there is 5 tests or less

--
Added file: http://bugs.python.org/file46918/bisect_test.py

___
Python tracker 

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



[issue30542] test_files() of test_tools.test_unparse.DirectoryTestCase leaks references

2017-06-01 Thread STINNER Victor

New submission from STINNER Victor:

haypo@selma$ ./python -m test -R 3:3 test_tools -m test_files
Run tests sequentially
0:00:00 load avg: 0.57 [1/1] test_tools
beginning 6 repetitions
123456
..
test_tools leaked [0, 4, 0] references, sum=4
test_tools leaked [0, 3, 0] memory blocks, sum=3
test_tools failed

1 test failed:
test_tools

Total duration: 12 sec
Tests result: FAILURE

Note: I found it using Zachary's x86 Gentoo Refleaks buildbot and bpo-29512.

--
components: Tests
messages: 294963
nosy: haypo
priority: normal
severity: normal
status: open
title: test_files() of test_tools.test_unparse.DirectoryTestCase leaks 
references
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



[issue29512] regrtest refleak: implement bisection feature

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't understand how issue30523 and issue30540 can help to resolve this issue.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-01 Thread Mario Corchero

New submission from Mario Corchero:

Define a way to disable the automatic generation of submocks when accessing an 
attribute of a mock which is not set.


Rationale:
Inspired by GMock RestrictedMock, it aims to allow the developer to declare a 
narrow interface to the mock that defines what the mocks allows to be called on.
The feature of mocks returning mocks by default is extremely useful but not 
always desired. Quite often you rely on it only at the time you are writing the 
test but you want it to be disabled at the time the mock is passed into your 
code.

It also prevents user errors when mocking incorrect paths or having typos when 
calling attributes/methods of the mock.
We have tried it internally in our company and it gives quite a nicer user 
experience for many use cases, specially for new users of mock as it helps out 
when you mock the wrong path.

Posible interfaces:
New Mock type, SeledMock which can be used instead of the "common" mock that 
has an attribute "sealed" which once set to true disables the dynamic 
generation of "submocks"


The final goal is to be able to write tests like:

>>> m = mock.Mock()  # or = mock.SealableMock()
>>> m.method1.return_value.attr1.method2.return_value = 1
>>> mock.seal(m)  # or mock.sealed = True

>>> m.method1().attr1.method2()  # This path has been declared above
# 1
>>> m.method1().attr2  # This was not defined so it is going to raise a 
>>> meaningful exception
# Exception: SealedMockAttributeAccess: mock.method1().attr2

--
components: Library (Lib)
messages: 294961
nosy: Mario Corchero, haypo
priority: normal
severity: normal
status: open
title: Add restricted mocks to the python unittest mocking framework
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



[issue25324] Importing tokenize modifies token

2017-06-01 Thread Albert-Jan Nijburg

Changes by Albert-Jan Nijburg :


--
pull_requests: +1990

___
Python tracker 

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



[issue17852] Built-in module _io can loose data from buffered files at exit

2017-06-01 Thread Xavier G. Domingo

Changes by Xavier G. Domingo :


--
nosy: +xgdomingo

___
Python tracker 

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



[issue30540] regrtest: add --matchfile option

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

This issue is the last part to implement the issue #29512: "regrtest refleak: 
implement bisection feature".

See also the second part, bpo-30523: unittest: add --list-tests option to only 
display the list of test names, don't run tests.

--

___
Python tracker 

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



[issue30540] regrtest: add --matchfile option

2017-06-01 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +1989

___
Python tracker 

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



[issue30537] Using PyNumber_AsSsize_t in itertools.islice

2017-06-01 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue30540] regrtest: add --matchfile option

2017-06-01 Thread STINNER Victor

New submission from STINNER Victor:

Attached pull request adds the --matchfile option to regrtest.

* Add a new option taking a filename to get a list of test names to filter 
tests.
* support.match_tests becomes a list.
* Modify run_unittest() to accept to match the whole test identifier, not just 
a part of a test identifier.
   
For example, the following command only runs test_default_timeout() of the 
BarrierTests class of test_threading:

$ ./python -m test -v test_threading -m 
test.test_threading.BarrierTests.test_default_timeout

--
components: Tests
messages: 294959
nosy: haypo, martin.panter, serhiy.storchaka
priority: normal
severity: normal
status: open
title: regrtest: add --matchfile option
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



[issue30475] Docs for PyDict_GetItemWithError() should say it returns a borrowed reference.

2017-06-01 Thread Eric Snow

Changes by Eric Snow :


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



[issue17852] Built-in module _io can loose data from buffered files at exit

2017-06-01 Thread Neil Schemenauer

Changes by Neil Schemenauer :


--
pull_requests: +1987

___
Python tracker 

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



[issue25324] Importing tokenize modifies token

2017-06-01 Thread Albert-Jan Nijburg

Albert-Jan Nijburg added the comment:

Aah! Oops I can fix later today.

On Thu, 1 Jun 2017 at 18:08, STINNER Victor  wrote:

>
> STINNER Victor added the comment:
>
> We got a bug report from Coverity:
>
> *** CID 1411801:  Incorrect expression  (MISSING_COMMA)
> /Parser/tokenizer.c: 111 in ()
> 105 "OP",
> 106 "AWAIT",
> 107 "ASYNC",
> 108 "",
> 109 "COMMENT",
> 110 "NL",
> >>> CID 1411801:  Incorrect expression  (MISSING_COMMA)
> >>> In the initialization of "_PyParser_TokenNames", a suspicious
> concatenated string ""ENCODING"" is produced.
> 111 "ENCODING"
> 112 ""
> 113 };
> 114
> 115
> 116 /* Create and initialize a new tok_state structure */
>
> I missed this typo :-p
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue25324] Importing tokenize modifies token

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

We got a bug report from Coverity:

*** CID 1411801:  Incorrect expression  (MISSING_COMMA)
/Parser/tokenizer.c: 111 in ()
105 "OP",
106 "AWAIT",
107 "ASYNC",
108 "",
109 "COMMENT",
110 "NL",
>>> CID 1411801:  Incorrect expression  (MISSING_COMMA)
>>> In the initialization of "_PyParser_TokenNames", a suspicious 
>>> concatenated string ""ENCODING"" is produced.
111 "ENCODING"
112 ""
113 };
114
115
116 /* Create and initialize a new tok_state structure */

I missed this typo :-p

--

___
Python tracker 

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



[issue17852] Built-in module _io can loose data from buffered files at exit

2017-06-01 Thread Neil Schemenauer

Neil Schemenauer added the comment:

"Did you get any ResourceWarning?"

I already knew that explicitly closing the file would fix the issue.  However, 
think of the millions of lines of Python 2 that hopefully will be converted to 
Python 3.  There will be many ResourceWarning errors.  It is not reasonable to 
think that everyone is just going to fix them when they see them.  Applications 
that used to be reliable will now randomly lose data.

What I spent hours debugging is trying to figure out why when the open file is 
collected on interpreter exit, buffered data not flushed.  I knew the object 
was not part of an uncollectable garbage cycle.  I initially suspected there 
could be some bug in the _io module or maybe even a kernel bug.

It turns out that in Python 2 the buffer and the open file is a single object 
and so when the finalizer gets called, the data is always correctly written 
out.  In Python 3, the buffer and the underlying file object are separate and 
they can get finalized in different order depending on essentially random 
factors.

Fixing this particular issue is not difficult as Armin's code demonstrates.  I 
don't think blaming the application programmer is the solution.  Obviously we 
keep the warnings and still tell programmers to close their files or use 
context managers.

--

___
Python tracker 

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



[issue30462] urllib does not support NO_PROXY environment variable containing domain with asterisk

2017-06-01 Thread Xiang Zhang

Xiang Zhang added the comment:

Hi Jiri, thanks for your PR. But at least we need a corresponding test and an 
entry in Misc/NEWS to complete the patch. Also, if your name is not in 
Misc/ACKS, please add it. :-)

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue30095] HTMLCalendar allow custom classes

2017-06-01 Thread Oz Tiram

Oz Tiram added the comment:

@Walter, I fixed the issues your raised, and also solved the merge conflict in 
What's New.

--

___
Python tracker 

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



[issue30351] regrtest hangs on x86 Windows XP 2.7

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

New failure on AMD64 Windows7 SP1 2.7:

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%202.7/builds/107/steps/test/logs/stdio

...
0:04:31 [402/403] test_ssl passed (32 sec) -- running: test_weakref (33 sec)
Resource 'sha256.tbs-internet.com' is not available
Resource 'ipv6.google.com' is not available

command timed out: 1200 seconds without output, attempting to kill
program finished with exit code 1
elapsedTime=1473.735000

--

___
Python tracker 

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



[issue30095] HTMLCalendar allow custom classes

2017-06-01 Thread Walter Dörwald

Walter Dörwald added the comment:

See comments on the pull request. Also it seems that currently the pull request 
can't be merged because of merge conflicts.

--

___
Python tracker 

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



[issue30351] regrtest hangs on x86 Windows XP 2.7

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

Similar issue on AMD64 OpenIndiana 2.7:

http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%202.7/builds/156/steps/test/logs/stdio

...
0:10:05 [400/403] test_old_mailbox passed -- running: test_bsddb3 (590 sec)
0:10:07 [401/403] test_imaplib passed -- running: test_bsddb3 (591 sec)
running: test_decimal (34 sec), test_bsddb3 (621 sec)
0:10:40 [402/403] test_decimal passed (37 sec) -- running: test_bsddb3 (625 sec)

command timed out: 1200 seconds without output running ['make', 'buildbottest', 
'TESTOPTS=-j2 -j4', 'TESTPYTHONOPTS=', 'TESTTIMEOUT=900'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=1848.193078

--

___
Python tracker 

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



[issue30339] test_multiprocessing_main_handling: "RuntimeError: Timed out waiting for results" on x86 Windows7 3.x

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

New failure:

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.5/builds/161/steps/test/logs/stdio


==
FAIL: test_directory (test.test_multiprocessing_main_handling.SpawnCmdLineTest)
--
Traceback (most recent call last):
  File 
"C:\buildbot.python.org\3.5.kloth-win64\build\lib\test\test_multiprocessing_main_handling.py",
 line 197, in test_directory
self._check_script(script_dir)
  File 
"C:\buildbot.python.org\3.5.kloth-win64\build\lib\test\test_multiprocessing_main_handling.py",
 line 155, in _check_script
rc, out, err = assert_python_ok(*run_args, __isolated=False)
  File 
"C:\buildbot.python.org\3.5.kloth-win64\build\lib\test\support\script_helper.py",
 line 150, in assert_python_ok
return _assert_python(True, *args, **env_vars)
  File 
"C:\buildbot.python.org\3.5.kloth-win64\build\lib\test\support\script_helper.py",
 line 136, in _assert_python
err))
AssertionError: Process return code is 1
command line: 
['C:\\buildbot.python.org\\3.5.kloth-win64\\build\\PCbuild\\amd64\\python_d.exe',
 '-X', 'faulthandler', '-E', 
'C:\\Users\\Buildbot\\AppData\\Local\\Temp\\tmpa4gpo3nq', 'spawn']

stdout:
---

---

stderr:
---
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.5.kloth-win64\build\lib\runpy.py", line 193, 
in _run_module_as_main
"__main__", mod_spec)
  File "C:\buildbot.python.org\3.5.kloth-win64\build\lib\runpy.py", line 85, in 
_run_code
exec(code, run_globals)
  File "C:\Users\Buildbot\AppData\Local\Temp\tmpa4gpo3nq\__main__.py", line 23, 
in 
raise RuntimeError("Timed out waiting for results")
RuntimeError: Timed out waiting for results
---

--

___
Python tracker 

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



[issue29920] Document cgitb.text and cgitb.html

2017-06-01 Thread Berker Peksag

Berker Peksag added the comment:

Please don't close it yet. I agree with Serhiy's comments in msg293394, but I 
couldn't find time to address his comments yet (plus we still need to backport 
the documentation update to 3.5 and 3.6 branches)

--

___
Python tracker 

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



[issue30378] SysLogHandler does not support IPv6 destinations

2017-06-01 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks calcheng for your report and Vinay for the review.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
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



[issue30378] SysLogHandler does not support IPv6 destinations

2017-06-01 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset 3ef3bcbe38e1913119c3022ca470d06908eeda3c by Xiang Zhang in branch 
'2.7':
bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses 
(#1904) (#1676)
https://github.com/python/cpython/commit/3ef3bcbe38e1913119c3022ca470d06908eeda3c


--

___
Python tracker 

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



[issue30378] SysLogHandler does not support IPv6 destinations

2017-06-01 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset 95b4da2be4aeb74ee46ddece71f2075b32915c60 by Xiang Zhang in branch 
'3.6':
bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses 
(#1676) (#1903)
https://github.com/python/cpython/commit/95b4da2be4aeb74ee46ddece71f2075b32915c60


--

___
Python tracker 

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



[issue30378] SysLogHandler does not support IPv6 destinations

2017-06-01 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset e20d22671996712eac416dd7bda79b5344d81164 by Xiang Zhang in branch 
'3.5':
bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses 
(#1676) (#1902)
https://github.com/python/cpython/commit/e20d22671996712eac416dd7bda79b5344d81164


--

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks Julien and Raymond.
PR has been merged and backported to 2.7, 3.5 and 3.6.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 662d856cd7d21dbdbd4043c1735d93b32568c9e5 by Mariatta in branch 
'2.7':
bpo-30499: Remove a deprecated note about sets. (GH-1848) (GH-1907)
https://github.com/python/cpython/commit/662d856cd7d21dbdbd4043c1735d93b32568c9e5


--

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 9d752aa5e695d682f3cfc40655580900b132e52a by Mariatta in branch 
'3.6':
bpo-30499: Remove a deprecated note about sets. (GH-1848) (GH-1905)
https://github.com/python/cpython/commit/9d752aa5e695d682f3cfc40655580900b132e52a


--

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 3419fc2bf1e81d42ef4578e59d3c10f9c239e80f by Mariatta in branch 
'3.5':
bpo-30499: Remove a deprecated note about sets. (GH-1848) (GH-1906)
https://github.com/python/cpython/commit/3419fc2bf1e81d42ef4578e59d3c10f9c239e80f


--

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-06-01 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1984

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-06-01 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1985

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-06-01 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1986

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-06-01 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 0737ee20671d60802a7ef40f653fe449f1921de0 by Mariatta (Julien) in 
branch 'master':
bpo-30499: Remove a deprecated note about sets. (GH-1848)
https://github.com/python/cpython/commit/0737ee20671d60802a7ef40f653fe449f1921de0


--

___
Python tracker 

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



[issue30539] Make Proactor public in asyncio.ProactorEventLoop

2017-06-01 Thread jabdoa

New submission from jabdoa:

pyserial-asyncio cannot use IOCP for serial sockets on windows because 
_proactor is private on the ProactorEventLoop. Can it be made public? 
Currently, pyserial-asyncio has to rely on polling for windows which is 
suboptimal.

Some forks use Proactor (e.g. 
https://github.com/m-labs/asyncserial/blob/master/asyncserial/asyncserial.py#L172)
 but it would be nice to use a stable API in official pyserial-asyncio. Issue 
for this is here: https://github.com/pyserial/pyserial-asyncio/issues/3

--
components: asyncio
messages: 294939
nosy: jabdoa, yselivanov
priority: normal
severity: normal
status: open
title: Make Proactor public in asyncio.ProactorEventLoop
versions: Python 3.3, Python 3.4, 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



[issue30378] SysLogHandler does not support IPv6 destinations

2017-06-01 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1983

___
Python tracker 

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-01 Thread Christian Heimes

Christian Heimes added the comment:

http://www.unicode.org/reports/tr46/#IDNA2008-Section

Additions. Some IDNs are invalid in IDNA2003, but valid in IDNA2008.
Subtractions. Some IDNs are valid in IDNA2003, but invalid in IDNA2008.
Deviations. Some IDNs are valid in both, but resolve to different 
destinations.

--

___
Python tracker 

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



[issue30378] SysLogHandler does not support IPv6 destinations

2017-06-01 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1982

___
Python tracker 

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



[issue30378] SysLogHandler does not support IPv6 destinations

2017-06-01 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1981

___
Python tracker 

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-01 Thread Christian Heimes

Christian Heimes added the comment:

zvyn, thanks for your patch.

However I'm sorry to say that Python stdlib's IDNA support is fundamentally 
broken by design. Therefore I'm against any IDNA related patches until we have 
addresses multiple issues with internationalized domain names. Our naive 
support of IDNA in socket module and ssl module is a security issue waiting to 
be happening.

* Python blindly assume that 'idna' is the only transformation of IDN U-labels 
into IDN A-labels. That's just plain wrong. Python's idna is really IDNA-2003.
* Besides IDNA 2003 there is also IDNA 2008. Of course the encodings are not 
compatible to each other.
* The old encoding IDNA-2003 and *MUST NOT* be used for some TLDs like .de 
because has an incorrect mapping for several characters like 'ß'.
* IDNA-2008 does not support upper case letters. Most applications want to use 
UTR46 mapping for IDNA-2008.
* On the application side, mapping of IDN U-labels must go through an 
additional validation layer to counteract homoglyphic confusion attacks. (e.g. 
cyrillic 'r' looks like latin 'p').

Before we add more security issues to libraries, we should come up with a plan 
to address this mess. First step: add IDNA-2008 and UTR46 support to stdlib.

I'm deeply sorry for dragging you into this mess. :/

PS: I have removed the 'easy' keyword.

--
keywords:  -easy

___
Python tracker 

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



[issue30378] SysLogHandler does not support IPv6 destinations

2017-06-01 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset 0b4b57df964f1ba427684556b8e5f05852454e0d by Xiang Zhang in branch 
'master':
bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses 
(#1676)
https://github.com/python/cpython/commit/0b4b57df964f1ba427684556b8e5f05852454e0d


--

___
Python tracker 

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



[issue30538] Functional Programming HOWTO describes one argument itertools.count()

2017-06-01 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
type:  -> enhancement

___
Python tracker 

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



[issue30538] Functional Programming HOWTO describes one argument itertools.count()

2017-06-01 Thread Cheryl Sabella

New submission from Cheryl Sabella:

The Functional Programming HOWTO describes single variable itertools.count 
instead of the two variable version that is linked to.

--
assignee: docs@python
components: Documentation
messages: 294935
nosy: csabella, docs@python
priority: normal
severity: normal
status: open
title: Functional Programming HOWTO describes one argument itertools.count()
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



[issue30537] Using PyNumber_AsSsize_t in itertools.islice

2017-06-01 Thread Michael Seifert

New submission from Michael Seifert:

In a question on StackOverflow 
(https://stackoverflow.com/questions/44302946/itertools-does-not-recognize-numpy-ints-as-valid-inputs-on-python-3-6)
 it was mentioned that numpys scalars cannot be used as index for 
`itertools.islice`. 

The reason for this is because the numbers are converted with 
`PyLong_AsSsize_t` (which requires a PyLongObject [or subclass]) instead of 
`PyNumber_AsSsize_t` (which only requires an `__index__` method).

I'm not sure if there are many use-cases where numpy scalars make sense as 
inputs for `islice` but it's definetly unexpected that `itertools.islice([1, 2, 
3, 4, 5, 6], np.int32(3))` currently throws a `ValueError: Stop argument for 
islice() must be None or an integer: 0 <= x <= sys.maxsize.`

--
components: Library (Lib)
messages: 294934
nosy: MSeifert
priority: normal
severity: normal
status: open
title: Using PyNumber_AsSsize_t in itertools.islice
type: behavior
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



[issue30526] Allow setting line_buffering on existing TextIOWrapper

2017-06-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 01/06/2017 à 12:41, Serhiy Storchaka a écrit :
> 
> First at all, I'm not sure that allowing to modify TextIOWrapper settings 
> after creation is a good idea. I would be feeling uncomfortable if the 
> third-party library changed the buffering or encoding settings of passed text 
> stream for its own needs, and this stream is sys.stdout.

Agreed that third-party libraries should not, but we're talking about
applications here.

> For example set f.line_buffering = False for performance and break your 
> logging. Creating a new TextIOWrapper for own needs looks safer.

Now you may have two TextIOWrappers alive wrapping the same buffered IO
object.

--

___
Python tracker 

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



[issue30526] Allow setting line_buffering on existing TextIOWrapper

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

First at all, I'm not sure that allowing to modify TextIOWrapper settings after 
creation is a good idea. I would be feeling uncomfortable if the third-party 
library changed the buffering or encoding settings of passed text stream for 
its own needs, and this stream is sys.stdout. For example set f.line_buffering 
= False for performance and break your logging. Creating a new TextIOWrapper 
for own needs looks safer. But changing the global state is the essential part 
of Nick's and your issues.

This could have long-term consequences, so it is worth to discuss the principle 
on the Python-Dev mailing list before applying the changes.

--

___
Python tracker 

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



[issue30536] SubinterpThreadingTests.test_threads_join_2() of test_threading leaks references

2017-06-01 Thread STINNER Victor

New submission from STINNER Victor:

Ah! I succeeded to hack a tool to bisect -m test -R 3:3 failure (issue #29512, 
I will publish it later, right now it's too hackish), so I found a first guilty 
of failure on the Gentoo Refleak failure.

Maybe it's related to recent Eric Snow's work. Maybe not. I didn't dig the bug 
yet.

haypo@selma$ ./python -m test -R 3:3 -m test_threads_join_2 test_threading
Run tests sequentially
0:00:00 load avg: 0.16 [1/1] test_threading
beginning 6 repetitions
123456
..
test_threading leaked [3, 3, 3] references, sum=9
test_threading failed

1 test failed:
test_threading

Total duration: 2 sec
Tests result: FAILURE

--
messages: 294932
nosy: eric.snow, haypo, serhiy.storchaka, zach.ware
priority: normal
severity: normal
status: open
title: SubinterpThreadingTests.test_threads_join_2() of test_threading leaks 
references
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



[issue30520] loggers can't be pickled

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> The fact that it creates a new logger if it doesn't exist is
> pretty much by design.

May be. I don't have a strong opinion.

--

___
Python tracker 

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



[issue29920] Document cgitb.text and cgitb.html

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I suggest to move the descriptions of text() and html() after handle(). And I 
don't know what to do with the discrepancy in the parameter name.

--
versions:  -Python 2.7, 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



[issue30535] Warn that meta_path is not empty

2017-06-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

A warning is probably too strong.  Also, it's easy to check sys.meta_path at 
the interpreter prompt, so I'm not sure it's worth mentioning at all.

--
nosy: +brett.cannon, eric.snow, ncoghlan, pitrou

___
Python tracker 

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



[issue29920] Document cgitb.text and cgitb.html

2017-06-01 Thread Xavier Morel

Xavier Morel added the comment:

Should I close this since the PR was merged?

--

___
Python tracker 

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



[issue30535] Warn that meta_path is not empty

2017-06-01 Thread Xavier Morel

Xavier Morel added the comment:

And it turns out the change was noted in the Python 3.3 release notes[0] though 
not all the consequences were spelled out (and the meta_path and path_hooks 
documentations were not changed)

[0] https://docs.python.org/3/whatsnew/3.3.html#visible-changes

--

___
Python tracker 

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



[issue30526] Allow setting line_buffering on existing TextIOWrapper

2017-06-01 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage:  -> patch review

___
Python tracker 

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



[issue30526] Allow setting line_buffering on existing TextIOWrapper

2017-06-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't think those two issues need to be merged.  Setting line_buffering and 
write_through is almost trivial, while setting the encoding seems to take a 
significant amount of effort.

That said, I agree that a unified interface may be nice.  Perhaps a 
reconfigure(**kwargs) method?

--

___
Python tracker 

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



[issue30535] Warn that meta_path is not empty

2017-06-01 Thread Xavier Morel

Xavier Morel added the comment:

Addendum: the warning was present (in the documentation) until Python 3.5, even 
though Python 3.3 is apparently where the "default finders" were moved to 
meta_path:

> python3.2 -c 'import sys;print(sys.meta_path)'
[]
> python3.3 -c 'import sys;print(sys.meta_path)'
[, , ]

--

___
Python tracker 

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



[issue30520] loggers can't be pickled

2017-06-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 01/06/2017 à 11:28, Serhiy Storchaka a écrit :
> 
> The idea LGTM. But we should first check that the logger is accessible by the 
> name: getLogger(self.name) is self. The same is done when pickling classes, 
> functions, etc. It shouldn't be a surprise on unpickler side.

Good idea.

> And maybe use not getLogger(), but different method which should fail if the 
> logger doesn't exist rather than creating it.

I disagree. The fact that it creates a new logger if it doesn't exist is
pretty much by design.  Typically, if you have:

class MyObject:
def __init__(self):
self.logger = getLogger('myobject')

then unpickling the first MyObject instance in a new process should also
create the 'myobject' logger instead of failing.

--

___
Python tracker 

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



[issue30526] Allow setting line_buffering on existing TextIOWrapper

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This looks similar to issue15216 and may be merged with it. At least setting 
line_buffering and encoding should have unified interface. I see two 
possibilities of making this Pythonic:

* Make attributes writeable.

* Add a method (configure(), reopen(), or like) that takes new values as 
keyword arguments. This allows to change several attributes at a time.

--
nosy: +ncoghlan, serhiy.storchaka

___
Python tracker 

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



[issue30520] loggers can't be pickled

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The idea LGTM. But we should first check that the logger is accessible by the 
name: getLogger(self.name) is self. The same is done when pickling classes, 
functions, etc. It shouldn't be a surprise on unpickler side.

And maybe use not getLogger(), but different method which should fail if the 
logger doesn't exist rather than creating it. Otherwise this looks as pickling 
open files by name.

--
nosy: +serhiy.storchaka
stage:  -> needs patch

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The details can be different. For example:

>>> 1 .__add__(x=2)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: wrapper __add__ doesn't take keyword arguments

The message contains the word "wrapper" and doesn't contains parenthesis. I 
think it can be extended for containing the type name ("int.__add__()" or 
"wrapper __add__ of in objects"), and this hard to do with general 
_PyErr_NoKeywords(). Let first unify messages, then try to add more useful 
information in messages and create a general API if this is possible.

--

___
Python tracker 

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



[issue30535] Warn that meta_path is not empty

2017-06-01 Thread Xavier Morel

New submission from Xavier Morel:

Encountered this issue porting Python 2 code manipulating meta_path to Python 3.

In Python 2, meta_path is empty by default and its documentation specifically 
notes that:

> sys.meta_path is searched before any implicit default finders or sys.path.

As a result, sys.meta_path.append() works perfectly well and is overwhelmingly 
common[0].

In Python 3, this note was removed but the documentation does not specifically 
state default finders are present in meta_path, and the old code using 
sys.meta_path.append may now break as the default finders will silently take 
precedence on the custom ones if they believe they can do the job.

I'd like to add a warning to the Python 3 documentation (3.5+?) noting the 
presence of existing default loaders, and to the Python 2 documentation 
suggesting `sys.meta_path.insert(0, finder)` for future-proofing, would there 
be objections or issues?

[0] https://github.com/search?q=meta_path.append=Code=✓

--
assignee: docs@python
components: Documentation
messages: 294919
nosy: docs@python, xmorel
priority: normal
severity: normal
status: open
title: Warn that meta_path is not empty
type: behavior
versions: Python 2.7, 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



[issue30397] Expose regular expression and match objects types in the re module

2017-06-01 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue30397] Expose regular expression and match objects types in the re module

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added GvR and Ivan because this is related to the typing module. This change 
allows re.Patter and re.Match be just imported from the re module.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

> Note that some error messages are "takes no keyword arguments", but others 
> are "does not take keyword arguments" or "doesn't take keyword arguments".

We already have a _PyArg_NoKeywords() function. Maybe we could add a new 
_PyErr_NoKeywords() function which would just raise the error?

--

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note that some error messages are "takes no keyword arguments", but others are 
"does not take keyword arguments" or "doesn't take keyword arguments". They 
should be unified. What wording is better?

--
stage:  -> patch review

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

See also "[Python-ideas] Positional-only parameters" discussion of last March:
https://mail.python.org/pipermail/python-ideas/2017-March/044956.html

Brett Cannon: "It seems all the core devs who have commented on this are in the 
positive (Victor, Yury, Ethan, Yury, Guido, Terry, and Steven; MAL didn't 
explicitly vote). So to me that suggests there's enough support to warrant 
writing a PEP. (...)"

(No, I didn't write such PEP yet :-p)

Maybe we can also enhance the error message to explain that the function 
accepts exactly one positional-only argument?

--

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

I introduced the regression with the commit 
7fc252adfbedece75f2330bcfdadbf84dee7836f: 

"Optimize _PyCFunction_FastCallKeywords(): Issue #29259: Write fast path in 
_PyCFunction_FastCallKeywords() for METH_FASTCALL, (...) Cleanup also 
_PyCFunction_FastCallDict(): (...) Move code to raise the "no keyword argument" 
exception into a new no_keyword_error label."

--

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-01 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1980

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

Ah, Python 3.6 is not affected:

haypo@selma$ ./python
Python 3.6.1+ (heads/unpack_dict:ba4fb35, May 31 2017, 16:31:51) 
>>> abs(x=5)
TypeError: abs() takes no keyword arguments

--

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

Example with a builtin function, abs(), which uses METH_O.

Before:

haypo@selma$ python3
Python 3.5.3 (default, Apr 24 2017, 13:32:13) 
>>> abs(x=5)
TypeError: abs() takes no keyword arguments

After:

haypo@selma$ ./python
Python 3.7.0a0 (heads/master:85aba23, May 31 2017, 10:29:03) 
>>> abs(x=5)
TypeError: abs() takes exactly one argument (0 given)

In Python 3.5, PyCFunction_Call() starts by checking keyword arguments:

if (flags == (METH_VARARGS | METH_KEYWORDS)) {
...
}
else {
if (kwds != NULL && PyDict_Size(kwds) != 0) {
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
 f->m_ml->ml_name);
return NULL;
}

switch (flags) {
case METH_NOARGS:
size = PyTuple_GET_SIZE(args);
if (size != 0) {
PyErr_Format(PyExc_TypeError,
"%.200s() takes no arguments (%zd given)",
f->m_ml->ml_name, size);
return NULL;
}
...


In Python 3.7, _PyMethodDef_RawFastCallKeywords() first check positional 
arguments:

switch (flags)
{
case METH_NOARGS:
if (nargs != 0) {
PyErr_Format(PyExc_TypeError,
"%.200s() takes no arguments (%zd given)",
method->ml_name, nargs);
goto exit;
}

if (nkwargs) {
goto no_keyword_error;
}

...

We can easily exchange the two checks, but IMHO we need an unit test (at least 
decorated by @cpython_only) to avoid regressions in the future.

--
nosy: +rhettinger

___
Python tracker 

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



[issue22898] segfault during shutdown attempting to log ResourceWarning

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

The issue #17852 is still alive and has a reference to this issue. It would be 
nice to rebase the latest patch on master and create a PR ;-)

--

___
Python tracker 

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



[issue17852] Built-in module _io can loose data from buffered files at exit

2017-06-01 Thread STINNER Victor

STINNER Victor added the comment:

Neil Schemenauer: "Well, I just spent a couple of hours debugging a problem 
caused by this issue."

Did you get any ResourceWarning? You need to run python3 with -Wd to see them.

By the way, I enhanced ResourceWarning in Python 3.6: if you enable 
tracemalloc, these warnings now log the traceback where the leakded resource 
was created ;-)
https://docs.python.org/dev/whatsnew/3.6.html#warnings

--

___
Python tracker 

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



  1   2   >