[issue32917] ConfigParser writes a superfluous final blank line

2018-03-09 Thread TitanSnow

TitanSnow  added the comment:

If we treat the original behavior as a bug,
it’s much easier to write a patch
that just changes the default behavior
and never outputs a final blank line.

I have looked through the testsuite of it.
It seems that the original author had knew
the final blank line and treat it as
expect result. I’m not sure about it.

--
Added file: https://bugs.python.org/file47474/simple.patch

___
Python tracker 

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



[issue33038] GzipFile doesn't always ignore None as filename

2018-03-09 Thread Diego Argueta

New submission from Diego Argueta :

The Python documentation states that if the GzipFile can't determine a filename 
from `fileobj` it'll use an empty string and won't be included in the header. 
Unfortunately, this doesn't work for SpooledTemporaryFile which has a `name` 
attribute but doesn't set it initially. The result is a crash.

To reproduce

```
import gzip
import tempfile

with tempfile.SpooledTemporaryFile() as fd:
with gzip.GzipFile(mode='wb', fileobj=fd) as gz:
gz.write(b'asdf')
```

Result:
```
Traceback (most recent call last):
  File "", line 2, in 
  File "/Users/diegoargueta/.pyenv/versions/2.7.14/lib/python2.7/gzip.py", line 
136, in __init__
self._write_gzip_header()
  File "/Users/diegoargueta/.pyenv/versions/2.7.14/lib/python2.7/gzip.py", line 
170, in _write_gzip_header
fname = os.path.basename(self.name)
  File "/Users/diegoargueta/.pyenv/versions/gds27/lib/python2.7/posixpath.py", 
line 114, in basename
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
```

This doesn't happen on Python 3.6, where the null filename is handled properly. 
I've attached a patch file that fixed the issue for me.

--
components: Library (Lib)
files: gzip_filename_fix.patch
keywords: patch
messages: 313512
nosy: da
priority: normal
severity: normal
status: open
title: GzipFile doesn't always ignore None as filename
type: crash
versions: Python 2.7
Added file: https://bugs.python.org/file47473/gzip_filename_fix.patch

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Brett Cannon  added the comment:

- [x] ast module for Python 3
- [x] compile() for Python 3
- [x] dbm.dumb.open()
- [ ] ast module for Python 2 (see https://github.com/python/cpython/pull/5960)
- [ ] compile() for Python 2 (see https://github.com/python/cpython/pull/6043)

At this point there is only Python 2 stuff and I'm not bothered enough to see 
those changed, so I will leave this open for anyone who wants to put in the 
effort to backport the warnings.

--
assignee: brett.cannon -> 
keywords: +easy -patch
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5809

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Change by Brett Cannon :


--
pull_requests: +5808

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Brett Cannon  added the comment:

@Serhiy: Correct, which is what the warning says: 
https://github.com/python/cpython/pull/6043/files .

--

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Yury Selivanov

Change by Yury Selivanov :


--
nosy:  -yselivanov

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

In 3.7 compile() can crash not only when compiling to an AST object (due to 
recursive AST optimization).

--

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Brett Cannon  added the comment:

Thanks for the feedback, Serhiy! Based on that, the new TODO list is:

- [x] ast module for Python 3
- [x] compile() for Python 3
- [ ] dbm.dumb.open()
- [ ] ast module for Python 2 (see https://github.com/python/cpython/pull/5960)
- [ ] compile() for Python 2 (see https://github.com/python/cpython/pull/6043)

--

___
Python tracker 

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



[issue32458] test_asyncio failures on Windows

2018-03-09 Thread Ned Deily

Ned Deily  added the comment:

Note, I think this failure is still happening occasionally on the windows7 
buildbot; for example:

http://buildbot.python.org/all/#/builders/111/builds/68/steps/3/logs/stdio
http://buildbot.python.org/all/#/builders/111/builds/85/steps/3/logs/stdio

--
nosy: +ned.deily

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I think we can ignore the inspect module. It is unlikely that it will cause a 
crash unintentionally, and it is hard to use this for attacks. The attacker 
needs to create an extension function with malicious __text_signature__, but if 
he is able to execute arbitrary binary code, there is a much larger problem.

And perhaps there is no need to repeat the warning for exec() and eval(). They 
are considered more dangerous than compile().

--

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5807

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5806

___
Python tracker 

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



[issue33037] Skip sending/receiving after SSL transport closing

2018-03-09 Thread Andrew Svetlov

Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue33037] Skip sending/receiving after SSL transport closing

2018-03-09 Thread Andrew Svetlov

New submission from Andrew Svetlov :

Now asyncio raises exceptions like "None type has no method feed_appdata" 
because self._sslpipe is set to None on closing.


See https://github.com/aio-libs/aiohttp/issues/2546 for more details.

IMHO the fix should just skip accessing self._sslpipe methods if the pipe was 
deleted.

--
components: Library (Lib), asyncio
messages: 313505
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Skip sending/receiving after SSL transport closing
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Change by Brett Cannon :


--
pull_requests: +5804

___
Python tracker 

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



[issue33014] Clarify doc string for str.isidentifier()

2018-03-09 Thread David Beazley

David Beazley  added the comment:

That wording isn't much better in my opinion.  If I'm sitting there looking at 
methods like str.isdigit(), str.isnumeric(), str.isascii(), and 
str.isidentifier(), seeing keyword.iskeyword() makes me think it's a method 
regardless of whether you label it a function or method.  Explicitly stating 
that "keyword" is actually the keyword module makes it much clearer. Or at 
least including the argument as well keyword.iskeyword(kw).

It really should be a string method though ;-)

--

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Brett Cannon  added the comment:

Actually, the TODO list is:

- [x] ast module for Python 3
- [ ] compile()
- [ ] eval() for >= 3.7
- [ ] exec() for >= 3.7
- [ ] dbm.dumb.open()
- [ ] inspect
- [ ] ast module for Python 2 (see https://github.com/python/cpython/pull/5960)

--

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Brett Cannon  added the comment:

I have the changes in for Python 3 for the ast module.

Updated TODO list:

- [x] ast module
- [ ] compile()
- [ ] eval() for >= 3.7
- [ ] exec() for >= 3.7
- [ ] dbm.dumb.open()
- [ ] inspect

--

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Brett Cannon  added the comment:


New changeset f2fffd41b42d88fe36b483852ae33d5a415b7082 by Brett Cannon (Miss 
Islington (bot)) in branch '3.7':
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the 
interpreter (GH-5960) (GH-6041)
https://github.com/python/cpython/commit/f2fffd41b42d88fe36b483852ae33d5a415b7082


--

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Brett Cannon  added the comment:


New changeset b316c44b0105d11a80ff971636143735f3655bbf by Brett Cannon (Miss 
Islington (bot)) in branch '3.6':
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the 
interpreter (GH-5960) (GH-6042)
https://github.com/python/cpython/commit/b316c44b0105d11a80ff971636143735f3655bbf


--

___
Python tracker 

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



[issue33015] Fix function cast warning in thread_pthread.h

2018-03-09 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +brett.cannon, pitrou

___
Python tracker 

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



[issue33014] Clarify doc string for str.isidentifier()

2018-03-09 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

No new string method ;-).  "Call function keyword.iskeyword() ..." should make 
it clear that iskeyword is not a string method.  Samyam, I suggest getting 
agreement on new wording first.  Then do PR that is more or less 'pre-approved'.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue24084] pstats: sub-millisecond display

2018-03-09 Thread Ned Deily

Ned Deily  added the comment:

Based on the review comments, it looks like the existing PR 3931 needs to be 
revised and resubmitted against current master branch.  So, can we close PR 
3931?

--
nosy: +ned.deily
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue33007] Objects referencing private-mangled names do not roundtrip properly under pickling.

2018-03-09 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +alexandre.vassalotti

___
Python tracker 

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



[issue30940] Documentation for round() is incorrect.

2018-03-09 Thread Ned Deily

Ned Deily  added the comment:

This issue seems to have slipped through the cracks with a couple of 
long-standing PR's open.  Anyone feel up to finishing it?

--
nosy: +ned.deily
stage: needs patch -> patch review
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue32987] tokenize.py parses unicode identifiers incorrectly

2018-03-09 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I verified on Win10 with 3.5 (which cannot be patched) and 3.7.0b2 that ab·cd 
is accepted as a name and that tokenize fails as described.

--
nosy: +terry.reedy
stage:  -> needs patch
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue30077] Support Apple AIFF-C pseudo compression in aifc.py

2018-03-09 Thread Ned Deily

Change by Ned Deily :


--
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5803

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5802

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-03-09 Thread Brett Cannon

Brett Cannon  added the comment:


New changeset 7a7f100eb352d08938ee0f5ba59c18f56dc4a7b5 by Brett Cannon in 
branch 'master':
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the 
interpreter (GH-5960)
https://github.com/python/cpython/commit/7a7f100eb352d08938ee0f5ba59c18f56dc4a7b5


--

___
Python tracker 

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



[issue33020] Tkinter old style classes

2018-03-09 Thread Ned Deily

Ned Deily  added the comment:

Thanks for the suggestion but I agree with Serhiy.  We should not make this 
kind of significant change to 2.7 at this stage of its life cycle.

--
nosy: +ned.deily
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue32993] urllib and webbrowser.open() can open w/ file: protocol

2018-03-09 Thread Ned Deily

Ned Deily  added the comment:

This is now marked as a security issue but I do not understand what the problem 
is.  urllib / urllib2 are supposed to be able to open file:// style URLs, that 
was not the point of Issue11662.  

https://docs.python.org/3/library/urllib.request.html#urllib.request.URLopener

And webbrowser also supports file: URLs if the underlying browser does; again, 
that's a standard feature.

So what's the problem 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



[issue32517] test_read_pty_output() of test_asyncio hangs on macOS 10.13.2 (darwin 17.3.0)

2018-03-09 Thread miss-islington

miss-islington  added the comment:


New changeset 3c39beb65d003b209a98a79af4aaf94ba16d0d29 by Miss Islington (bot) 
in branch '3.7':
bpo-32517: fix test_read_pty_output() hangs on macOS 10.13.2+ (GH-6037)
https://github.com/python/cpython/commit/3c39beb65d003b209a98a79af4aaf94ba16d0d29


--
nosy: +miss-islington

___
Python tracker 

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



[issue32517] test_read_pty_output() of test_asyncio hangs on macOS 10.13.2 (darwin 17.3.0)

2018-03-09 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5801

___
Python tracker 

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



[issue32517] test_read_pty_output() of test_asyncio hangs on macOS 10.13.2 (darwin 17.3.0)

2018-03-09 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 12f74d8608c15cacd9d5786524e2be9ca36f007e by Yury Selivanov 
(Nathan Henrie) in branch '3.6':
bpo-32517: fix test_read_pty_output() hangs on macOS 10.13.2+ (GH-6037)
https://github.com/python/cpython/commit/12f74d8608c15cacd9d5786524e2be9ca36f007e


--

___
Python tracker 

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



[issue32576] concurrent.futures.thread deadlock due to Queue in weakref callback

2018-03-09 Thread Ned Deily

Ned Deily  added the comment:

Yes, backporting all of the required code to earlier releases would be out of 
scope for a maintenance release, particularly at this late stage in the 3.6 
life cycle.  Let's see whether disabling the GC is a sufficient workaround 
until 3.7 is available.

--

___
Python tracker 

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



[issue33036] test_selectors.PollSelectorTestCase failing on macOS 10.13.3

2018-03-09 Thread Ned Deily

Ned Deily  added the comment:

Sorry, I am not seeing this failure on 10.13.3 with either current 3.6 head or 
with v3.6.1.  Didn't try anything else.

--
nosy: +ned.deily

___
Python tracker 

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



[issue33036] test_selectors.PollSelectorTestCase failing on macOS 10.13.3

2018-03-09 Thread Nathan Henrie

Nathan Henrie  added the comment:

Traceback:

```
  File "cpython/Lib/test/test_selectors.py", line 453, in test_above_fd_setsize
self.assertEqual(NUM_FDS // 2, len(s.select()))
  File "cpython/Lib/selectors.py", line 376, in select
fd_event_list = self._poll.poll(timeout)
OSError: [Errno 22] Invalid argument
```

--

___
Python tracker 

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



[issue33036] test_selectors.PollSelectorTestCase failing on macOS 10.13.3

2018-03-09 Thread Nathan Henrie

New submission from Nathan Henrie :

Failing for me on latest 3.6, 3.6.1, 3.5.5, may be related to 
https://bugs.python.org/issue32517, presumably a change on macOS KQueue stuff.

Can anyone else on macOS 10.13.3 see if they can reproduce?

```
make clean && ./configure --with-pydebug && make -j
./python.exe -m unittest -v test.test_selectors.PollSelectorTestCase
```

--
components: Tests
messages: 313487
nosy: n8henrie
priority: normal
severity: normal
status: open
title: test_selectors.PollSelectorTestCase failing on macOS 10.13.3
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



[issue33035] Some examples in documentation section 4.7.2 are incorrect

2018-03-09 Thread Emanuel Barry

Emanuel Barry  added the comment:

The documentation is correct. The first argument in both of those cases is a 
str, which may not be what you were expecting, but the calls are still valid.

--
nosy: +ebarry
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue33035] Some examples in documentation section 4.7.2 are incorrect

2018-03-09 Thread Stephen Wille Padnos

New submission from Stephen Wille Padnos :

Section 4.7.2 of the documentation, "Keyword Arguments", has several examples 
of valid calls to the sample function parrot.

The function definition is:
def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):

The last two calls in the valid samples are actually not valid, since they are 
missing the required "voltage" parameter.
parrot('a million', 'bereft of life', 'jump') # 3 positional arguments
parrot('a thousand', state='pushing up the daisies')  # 1 positional, 1 keyword

They should be changed to include a value for voltage, along with a change to 
the comment:
parrot(1000, 'a million', 'bereft of life', 'jump') # 4 positional 
arguments
parrot(1000, 'a thousand', state='pushing up the daisies')  # 2 positional, 1 
keyword

This issue is present in all currently available versions of the documentation: 
2.7; 3.5; 3.6.4; pre (3.7); and dev (3.8).

--
assignee: docs@python
components: Documentation
messages: 313485
nosy: docs@python, stephenwp
priority: normal
severity: normal
status: open
title: Some examples in documentation section 4.7.2 are incorrect
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-09 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

Regarding status quo (expanding the examples of @inada.naoki and @jab):

>>> import typing
>>> import collections.abc as cabc
>>> issubclass(typing.Mapping, cabc.Mapping)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/izbyshev/workspace/cpython/Lib/abc.py", line 143, in 
__subclasscheck__
return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class
>>> from abc import ABC
>>> issubclass(typing.Mapping, ABC)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/izbyshev/workspace/cpython/Lib/abc.py", line 143, in 
__subclasscheck__
return _abc_subclasscheck(cls, subclass)
  File "/home/izbyshev/workspace/cpython/Lib/abc.py", line 143, in 
__subclasscheck__
return _abc_subclasscheck(cls, subclass)
  File "/home/izbyshev/workspace/cpython/Lib/contextlib.py", line 30, in 
__subclasshook__
return _collections_abc._check_methods(C, "__enter__", "__exit__")
  File "/home/izbyshev/workspace/cpython/Lib/_collections_abc.py", line 73, in 
_check_methods
mro = C.__mro__
  File "/home/izbyshev/workspace/cpython/Lib/typing.py", line 706, in 
__getattr__
raise AttributeError(attr)
AttributeError: __mro__
>>> ABC.register(int)

>>> issubclass(typing.Mapping, ABC)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/izbyshev/workspace/cpython/Lib/abc.py", line 143, in 
__subclasscheck__
return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class
>>> typing.Mapping.__mro__ = ()
>>> issubclass(typing.Mapping, ABC)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/izbyshev/workspace/cpython/Lib/abc.py", line 143, in 
__subclasscheck__
return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class
>>> typing.Mapping.__bases__ = ()
>>> issubclass(typing.Mapping, ABC)
False

Can't say that I'm OK with it :) 

I'm for forbidding non-types in ABCMeta.__subclasscheck__, but if we are to add 
clean support for "class-likes" instead, I think that "class-like" objects 
should be clearly defined, for example, that they must have __mro__ and 
__bases__ (and probably support weakrefs unless we want to skip caching if they 
don't). ABCMeta.__subclasscheck__ is not standalone: it relies on issubclass() 
and __subclasshook__, and both of them have some expectations in practice.

--

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-09 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

To be honest I am still undecided on this. In principle, I am OK with status 
quo, but I am also OK, with the PR that will prohibit non-classes. I am a bit 
worried that it may break some existing code, so it is probably not for 3.7.

--

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-09 Thread INADA Naoki

INADA Naoki  added the comment:

>> Isn't it just a limitation?
>> Most Python-implemented objects supports weakref. I don't think "requiring 
>> weakref support implies it must be type object".

> Formally, there is no implication. It is the abc module authors who know the 
> truth. But I can't imagine why anybody would impose such a limitation by 
> design, because while instances of user-defined classes support weakrefs, 
> built-in classes used by everybody like tuple, list and dict don't. That's 
> why I guessed that non-types were not meant to be supported.

Of course, issubclass(42, AnyABC) must raise TypeError.  They aren't class-like 
object. I didn't discuss on it.

I talked about class-like objects.
For example, this code works on Python 3.6, but not on 3.7.  typing.Mapping 
looks like type, but it is just an instance for 3.7.

  import typing
  import collections.abc as cabc
  print(issubclass(typing.MutableMapping, cabc.Mapping))  # Python 3.7 raises 
TypeError

I don't think it's real problem.  But if someone claims it's real issue, we can 
make typing.MutableMapping more "class-like" by adding __mro__.

diff --git a/Lib/typing.py b/Lib/typing.py
index 7ca080402e..2edaa3f868 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -619,6 +619,7 @@ def __init__(self, origin, params, *, inst=True, 
special=False, name=None):
   a for a in params)
 self.__parameters__ = _collect_type_vars(params)
 self.__slots__ = None  # This is not documented.
+self.__mro__ = (origin,) + getattr(origin, '__mro__', (object,))
 if not name:
 self.__module__ = origin.__module__


Again, I don't think it's a real problem.
Maybe, we can add the check, and revert it if someone claims.

--

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-09 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

1. We have an agreement that we need `asyncSetUp` and all family. I strongly 
support it. `super()` call is crucial argument I think.

2. Should async setup/teardown methods be a part of `unittest.TestCase` or we 
need a new AsyncTestCase class?

I believe adding async methods to TestCase makes no sense: without instructions 
how to run async code these methods are pretty useless and error-prone. 
Implementation of async startup/teardown without providing async runner (read 
about a runner below) looks like a error. If we mix everything into TestCase we 
should support virtually both modes in the single TestCase class: one for 
sync-only test case and other for async tests with async setup/teardown.

3. The next question is: should we support *every not existing yet* async 
framework by our tools or asyncio-compatible only. 
*Not existing yet* means we have no idea how to create a test loop, prepare it, 
run a test by loop, tear down everything.
Sure, we can invite a `async function runner` concept but I request a PEP for 
such significant addition with full specification.

Zachary Ware proposed `coroutine_runner` property in `TestCase`.
What is `coroutine_runner`? How should it work? How to run a coroutine? 
Subscribe for a UNIX signal or spawn a subprocess (asyncio has many tricks for 
signal/subprocess support, pretty sure they are not compatible with curio/trio 
approach)? Should we expose unified timer/socket/file API?
Is it ok that correct asyncio code will fail or even hang if `coroutine_runner` 
is not compatible with asyncio? If no -- that is benefit of *unified runner* if 
we need to use concrete runner family for writing tests?

In case of limiting build-in `AsyncioTestCase` to asyncio only we narrow down 
to very well defined asyncio API. Tornado and Twisted declared asyncio 
compatibility, they should work with the test case class.

curio/trio explicitly declared incompatibility with asyncio. That's fine, we 
should not support them by standard unittest classes too because we have no way 
to write tests for non-specified-yet contracts.

--

___
Python tracker 

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



[issue32917] ConfigParser writes a superfluous final blank line

2018-03-09 Thread TitanSnow

TitanSnow  added the comment:

I’m afraid of breaking the backward compatibility.

--

___
Python tracker 

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



[issue32576] concurrent.futures.thread deadlock due to Queue in weakref callback

2018-03-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Michał, sorry, I doubt it.  The fix is highly non-trivial as it first requires 
backporting a new feature (see issue14976).  I'm cc'ing the 3.6 branch release 
manager just in case.

If apparently you're witnessing this in controlled situations (the "gemato" 
utility, IIUC?), one workaround would be to disable the cyclic GC (call 
gc.disable()).  If your program doesn't create any cyclic references, or if 
those references don't keep too much memory alive, that would probably work.

--
nosy: +ned.deily

___
Python tracker 

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



[issue33033] Clarify that the signed number convertors to PyArg_ParseTuple... *do* overflow checking

2018-03-09 Thread Antony Lee

Antony Lee  added the comment:

One could just add, immediately below the "Numbers" section, something like: 
"The signed convertors (b, h, i, ...) perform overflow checking.  The unsigned 
convertors (B, H, I, ...) do not."  That would actually be shorter than the 
current version, which repeats the second half for each unsigned entry...

--

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-09 Thread Jonathan

Jonathan  added the comment:

Arguably the same logic applies to out-of-range ports:

> a = urlsplit('http://example.com:444')
> a.port
Traceback (most recent call last):
  File "", line 1, in 
  File "E:\Software\_libs\Python36\lib\urllib\parse.py", line 169, in port
raise ValueError("Port out of range 0-65535")
ValueError: Port out of range 0-65535

--

___
Python tracker 

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



[issue32576] concurrent.futures.thread deadlock due to Queue in weakref callback

2018-03-09 Thread Michał Górny

Michał Górny  added the comment:

Could you get this fixed in earlier versions of CPython? Given that 3.7 is not 
yet released, having this broken in 3.5 and 3.6 is highly undesirable. This 
apparently seems to affect our tooling [1] and telling our users to use 3.7 
beta is not an option.

[1]:https://bugs.gentoo.org/647964

--
nosy: +mgorny

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-09 Thread Jonathan

New submission from Jonathan :

(Confirmed in 2.7.14, 3.5.4, and 3.6.3)

I have this really bad URL from a crawl:
"http://Server=sde; Service=sde:oracle$sde:oracle11g:geopp; User=bodem; 
Version=SDE.DEFAULT"

if I try and parse it with wither urlparse or urlsplit it works - no errors. 
But when I try and get the port, I get a ValueError.

> from urllib.parse import urlparse
> r = urlparse('http://Server=sde; Service=sde:oracle$sde:oracle11g:geopp; 
> User=bodem; Version=SDE.DEFAULT')
ParseResult(scheme='http', netloc='Server=sde; 
Service=sde:oracle$sde:oracle11g:geopp; User=bodem; Version=SDE.DEFAULT', 
path='', params='', query='', fragment='')

Ok, great, now to use the result:
> print(r.port)
Traceback (most recent call last):
  File "", line 1, in 
  File "E:\Software\_libs\Python36\lib\urllib\parse.py", line 167, in port
port = int(port, 10)
ValueError: invalid literal for int() with base 10: 
'oracle$sde:oracle11g:geopp; User=bodem; Version=SDE.DEFAULT'


I'm not a Python Guru, but to me at least it's inconsistent with how every 
other Python Function works. In all other builtin functions I've used it would 
fail with the exception when I ran the function, not when I try and get the 
results. This caused a good few minutes of head-scratching while I tried to 
debug why my try/except wasn't catching it.

This inconsistency makes the results more difficult to use. Now a user needs to 
wrap all calls to the *results* in a try/except, or write an entire function 
just to "read" the results into a won't-except tuple/dict. Seems sub-optimal.


(May relate to: https://bugs.python.org/issue20059)

--
messages: 313475
nosy: jonathan-lp
priority: normal
severity: normal
status: open
title: urllib.parse.urlparse and urlsplit not raising ValueError for bad port
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-09 Thread Jonathan

Change by Jonathan :


--
versions: +Python 3.5

___
Python tracker 

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