[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Sanjay

New submission from Sanjay:

according to the docs compare_networks only checks the network address but the 
implementation is also taking the mask length into account. It returns '0' only 
if both the network address and the mask are equal but this can be done with 
just equality check ( ip1 == ip2 )

Example:
>>> ip1=ipaddress.ip_network("1.1.1.0/24")
>>> ip2=ipaddress.ip_network("1.1.1.0/25")
>>> ip1.compare_networks(ip2)
-1
>>> ip1 == ip2
False
>>> ip1.network_address
IPv4Address('1.1.1.0')
>>> ip2.network_address
IPv4Address('1.1.1.0')
>>> 

shouldn't we ignore the mask length ? I have tried it here:

https://github.com/s-sanjay/cpython/commit/942073c1ebd29891e047b5e784750c2b6f74494a

--
components: Library (Lib)
messages: 290566
nosy: Sanjay
priority: normal
severity: normal
status: open
title: ipadress compare_networks does not work according to documentation
type: behavior
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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Sanjay

Changes by Sanjay :


--
pull_requests: +739

___
Python tracker 

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



[issue29914] Incorrect signatures of object.__reduce__() and object.__reduce_ex__()

2017-03-27 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The special method __reduce__() doesn't take arguments, the special method 
__reduce_ex__() takes one mandatory argument. But default implementations in 
the object class takes one optional argument. This looks as an oversign. 
Proposed patch fixes signatures of object.__reduce__() and 
object.__reduce_ex__().

--
components: Interpreter Core
messages: 290567
nosy: alexandre.vassalotti, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Incorrect signatures of object.__reduce__() and object.__reduce_ex__()
type: behavior
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



[issue29914] Incorrect signatures of object.__reduce__() and object.__reduce_ex__()

2017-03-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +740

___
Python tracker 

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



[issue29910] Ctrl-D eats a character on IDLE

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> (Not having side by side diffs as with Rietveld makes this much harder.)

Click on the "Files changed" tab on the PR page: 
https://github.com/python/cpython/pull/825/files . You can add inline comments 
when click on the "+" button that follows your mouse cursor. After entering the 
comment press the GREEN "Start a review" button rather than "Add single 
comment". This will allow to send all your comments at once rather than sending 
them as separate emails, and will allow to edit or remove comments before 
sending them. After reviewing all changes press the GREEN button at the top 
right corner of the page for sending your comments.

Yes, it is my fault that I missed the conflict. But the user can add 
conflicting shortcuts for other events, so it would be better to make them safe 
even if there re not conflicts in standard configuration.

> In some places, you add "return None" instead.

PEP 8: "Be consistent in return statements. Either all return statements in a 
function should return an expression, or none of them should. If any return 
statement returns an expression, any return statements where no value is 
returned should explicitly state this as return None , and an explicit return 
statement should be present at the end of the function (if reachable)."

> If there is a masked binding, having 'key-x' do one thing sometimes and 
> something else other times would seem disconcerting. 

I think this is okay. In the specific context one this is done, but if this 
context does not exist fall back to doing other thing.

I don't think special tests are needed. There are too much event handlers, and 
testing them with monkey-patching will just complicate the code and will not 
check anything beside the fact that that event handlers are written in special 
style.

--

___
Python tracker 

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



[issue1025395] email.Utils.parseaddr fails to parse valid addresses

2017-03-27 Thread ioanatia

Changes by ioanatia :


--
nosy: +ioanatia

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +ncoghlan, pmoody

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Xiang Zhang

Xiang Zhang added the comment:

In my mind this is the wanted behaviour. `compare_networks` means compare one 
network to another and a network should count its mask in. Your example would 
look rather weird if 1.1.1.0/24 == 1.1.1.0/25. Maybe make the doc from 'network 
addresses' to 'network bits' is easier to understand.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29915] Drop Mac OS X Tiger support in Python 3.7?

2017-03-27 Thread STINNER Victor

New submission from STINNER Victor:

Hi,

Last september I already proposed the same thing for Python 3.6 (issue #28099), 
but Ned Deily asked to keep OS X Tiger supper.

The Tiger buildbot fails since many years:
http://buildbot.python.org/all/builders/x86%20Tiger%203.x/builds/479/steps/test/logs/stdio

It doesn't seem like anyone take care of this buildbot.

Mac OS X Tiger was released in 2004 (13 years ago). The last update was 
10.4.11: November 14, 2007 (9 years ago).

"Support status: Unsupported as of September 2009, Safari support ended 
November 2010."
https://en.wikipedia.org/wiki/Mac_OS_X_Tiger

--
components: Build
messages: 290570
nosy: haypo, ned.deily
priority: normal
severity: normal
status: open
title: Drop Mac OS X Tiger support in Python 3.7?
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



[issue27425] Tests fail because of git's newline preferences on Windows

2017-03-27 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +741

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Sanjay

Sanjay added the comment:

yes but compare_networks is not used to implement equality check. __eq__ 
correctly returns False when we do 1.1.1.0/24 == 1.1.1.0/25.
If compare_networks works exactly like __eq__ then it seems a bit redundant.

--

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Nick Coghlan

Nick Coghlan added the comment:

Looking into it, this appears to be a holdover from the original ipaddr design 
where rather than being modelled as separate objects, host interfaces are 
modelled as denormalised network objects (i.e. a host address with a netmask).

So the stdlib equivalent of the original ipaddr compare_networks() operation 
would be:

>>> ip_interface('192.0.2.1/31').network == ip_network('192.0.2.0/31')
True

As Sanjay noted, compare_networks() itself is fairly redundant given the 
stricter stdlib data model, since we don't allow the creation of denormalised 
network definitions in the first place:

```
>>> ip_network('192.0.2.1/31')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.5/ipaddress.py", line 74, in ip_network
return IPv4Network(address, strict)
  File "/usr/lib64/python3.5/ipaddress.py", line 1536, in __init__
raise ValueError('%s has host bits set' % self)
ValueError: 192.0.2.1/31 has host bits set
```

--

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Xiang Zhang

Xiang Zhang added the comment:

I still hold my opinion that the current behaviour is correct. You are 
comparing two networks and you should count the mask in. 

And notice that `neta == netb` is not totally equal to 
`neta.compare_networks(netb)`. The former can only results True or False but 
the later could result -1, 0 and 1. For example:

>>> IPv4Network('192.0.2.0/25') == IPv4Network('192.0.2.0/25')
True
>>> IPv4Network('192.0.2.0/25').compare_networks(IPv4Network('192.0.2.0/25'))
0
>>> 

They can't be used exchangably. `compare_networks` actually does the work of 
all <, >, ==.

--

___
Python tracker 

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



[issue29916] No explicit documentation for PyGetSetDef and getter and setter C-API

2017-03-27 Thread Michael Seifert

New submission from Michael Seifert:

A copy of the struct definition can be found in the typeobject documentation 
[1]. There is also some explanation of the "closure" function pointer in the 
extending tutorial [2].

However the struct isn't explicitly defined as "c:type" so the 6 links to it in 
the documentations go nowhere.

I also submitted a pull request.

[1] https://docs.python.org/3.6/c-api/typeobj.html#c.PyTypeObject.tp_getset
[2] https://docs.python.org/3/extending/newtypes.html

--
assignee: docs@python
components: Documentation
messages: 290574
nosy: MSeifert, docs@python
priority: normal
pull_requests: 742
severity: normal
status: open
title: No explicit documentation for PyGetSetDef and getter and setter C-API

___
Python tracker 

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



[issue29917] Wrong link target in PyMethodDef documentation

2017-03-27 Thread Michael Seifert

New submission from Michael Seifert:

The `link`-target of the "type" struct member is the python built-in "type".  
See [1].

I think it should not be a link at all.

[1] https://docs.python.org/3.7/c-api/structures.html#c.PyMemberDef

--
assignee: docs@python
components: Documentation
messages: 290575
nosy: MSeifert, docs@python
priority: normal
severity: normal
status: open
title: Wrong link target in PyMethodDef documentation

___
Python tracker 

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



[issue18059] Add multibyte encoding support to pyexpat

2017-03-27 Thread Walter Dörwald

Walter Dörwald added the comment:

This looks to me like a limited reimplementation of the codec machinery. Why 
not use incremental codecs as a preprocessor? Would this be to slow?

--

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Nick Coghlan

Nick Coghlan added the comment:

Right, I agree compare_networks() is behaving correctly according to its 
original design. However:

- it was designed for Python 2, where cmp() style idioms were still more 
common. Those idioms have largely been removed in Python 3 (no cmp() builtin, 
no __cmp__ magic method, no cmp argument to list.sort() and sorted())

- it was designed for the ipaddr data model, where network equality comparisons 
are more like ipaddress.ip_interface comparisons than they ipaddress.ip_network 
comparisons

Since there isn't any real maintenance burden in keeping the code around, I'm 
flipping this to be purely a documentation issue and suggesting that we:

- mark the method as deprecated in the docs, but *not* in the code (using the 
method form is just kind of pointless, not actively harmful)

- update the docs to say that it uses the same ordering and comparison 
algorithm as "<", "==", and ">" (the current confusion stems from the fact that 
the algorithms were different in ipaddr, but in the stdlib that other algorithm 
is the one used by interface objects, not network objects)

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
stage:  -> needs patch

___
Python tracker 

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



[issue12414] getsizeof() on code objects is wrong

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

code_sizeof() must be updated to take in account co_extra memory: 
co_extra.ce_size * sizeof(co_extra.ce_extras[0]) bytes.

--
nosy: +haypo

___
Python tracker 

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



[issue29913] ipadress compare_networks does not work according to documentation

2017-03-27 Thread Xiang Zhang

Xiang Zhang added the comment:

+1 for the doc change.

--

___
Python tracker 

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



[issue11989] deprecate shutil.copy2

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

I like proposed changed.

--
nosy: +haypo
status: pending -> open

___
Python tracker 

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



[issue29899] zlib missing when --enable--optimizations option appended

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

Can you please attach config.log file? And maybe also redirect the output of 
"make" into a log file and then attach this log file as well? Example: make 
2>&1 >make.log.

--
nosy: +haypo

___
Python tracker 

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



[issue23241] shutil should accept pathlib types

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

I'm unable to reproduce the bug on Python 3.6:
---
from pathlib import Path
import shutil
import os
def touch(name):
with open(name, "x"):
pass
os.mkdir('a')
touch('a/x')
touch('a/y')
touch('a/z')
os.mkdir('b')
source_path = Path('a')
destination_path = Path('b')
for file_name in source_path.glob('*'):
file_name = file_name.name
src = source_path / file_name
dst = destination_path / file_name
print("%r -> %r" % (src, dst))
shutil.copyfile(src, dst)
---

Output:
---
PosixPath('a/y') -> PosixPath('b/y')
PosixPath('a/x') -> PosixPath('b/x')
PosixPath('a/z') -> PosixPath('b/z')
---

Thank you PEP 519 ;-)

--
nosy: +haypo
resolution:  -> fixed
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue20552] Use specific asserts in bytes tests

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 604e74c6beb2585c81083fa85f0e5a4d46965cbc by Victor Stinner 
(Serhiy Storchaka) in branch 'master':
bpo-20552: Use specific asserts in bytes tests (#790)
https://github.com/python/cpython/commit/604e74c6beb2585c81083fa85f0e5a4d46965cbc


--
nosy: +haypo

___
Python tracker 

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



[issue21071] struct.Struct.format is bytes, but should be str

2017-03-27 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +743

___
Python tracker 

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



[issue21071] struct.Struct.format is bytes, but should be str

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

I created https://github.com/python/cpython/pull/845 to change 
struct.Struct.format type to str (Unicode).

struct.Struct() accepts bytes and str format strings, so it's not really a 
backward incompatible change.

It's just a minor enhancement to help development:

$ ./python
Python 3.7.0a0 (heads/master-dirty:b8a7daf, Mar 27 2017, 13:02:20) 
>>> print(struct.Struct('hi').format)
hi


Without the patch:

haypo@selma$ python3
Python 3.5.2 (default, Sep 14 2016, 11:28:32) 
[GCC 6.2.1 20160901 (Red Hat 6.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> print(struct.Struct('hi').format)
b'hi'

haypo@selma$ python3 -bb
Python 3.5.2 (default, Sep 14 2016, 11:28:32) 
>>> import struct
>>> print(struct.Struct('hi').format)
Traceback (most recent call last):
  ...
BytesWarning: str() on a bytes instance

--

___
Python tracker 

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



[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

Chi Hsuan Yen confirmed that "python3.7m -m test test_curses -u curses" now 
pass on Android, so I close the issue. Thanks.

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



[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

"I am not sure whether such a platform exists, but on a platform where 
SIZEOF_VOID_P < SIZEOF_LONG, PyLong_AsVoidPtr ..."

I'm suite sure that every C function of CPython breaks if this assumption 
becomes wrong :-) Such platform doesn't exist.

You can add the build assertion if it makes you more confortable ;-)

--
nosy: +haypo

___
Python tracker 

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



[issue29680] gdb/libpython.py does not work with gdb 7.2

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

@belopolsky: Tools/gdb/libpython.py still uses gdb.error in 
gdb.selected_frame():

try:
frame = cls.get_selected_frame()
except gdb.error:
# No frame: Python didn't start yet
return None

See my commit 610f5d739dd22bce352bde59dce3985c73aaefab. Should we change this 
line as well?

--

___
Python tracker 

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



[issue29918] Missed "const" modifiers in C API documentation

2017-03-27 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch adds missed "const" modifiers in C API documentation.

--
assignee: docs@python
components: Documentation
messages: 290588
nosy: docs@python, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Missed "const" modifiers in C API documentation
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



[issue29572] Upgrade installers to OpenSSL 1.0.2k

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

FYI I started to track OpenSSL versions in my "Python security" documentation:
http://python-security.readthedocs.io/ssl.html#openssl-versions

It seems like all pull requests are merged. Can the issue be closed now?

--
nosy: +haypo

___
Python tracker 

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



[issue29912] Overlapping tests between list_tests and seq_tests

2017-03-27 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Correction: test_index *partially* duplicates the base class method. It too can 
be modified to use super like test_imul.

--

___
Python tracker 

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



[issue29918] Missed "const" modifiers in C API documentation

2017-03-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +744

___
Python tracker 

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



[issue29899] zlib missing when --enable--optimizations option appended

2017-03-27 Thread kyren

kyren added the comment:

This is the config.log.

--
Added file: http://bugs.python.org/file46757/config.log

___
Python tracker 

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



[issue29899] zlib missing when --enable--optimizations option appended

2017-03-27 Thread kyren

kyren added the comment:

This is make.log.

--
Added file: http://bugs.python.org/file46758/make.log

___
Python tracker 

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



[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I'm suite sure that every C function of CPython breaks if this assumption 
> becomes wrong :-) Such platform doesn't exist.

Did you meant 64-bit Windows? ;-)

--

___
Python tracker 

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



[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

> Did you meant 64-bit Windows? ;-)

On Windows 64-bit, sizeof(void*) > sizeof(long), not the opposite.

--

___
Python tracker 

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



[issue21071] struct.Struct.format is bytes, but should be str

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This should be discussed on Python-Dev first. I already raised this issue on 
Python-Dev, but don't remember what is the result.

--

___
Python tracker 

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



[issue21071] struct.Struct.format is bytes, but should be str

2017-03-27 Thread Martin Panter

Martin Panter added the comment:

Hi Victor, I’m not sure about changing the data type. As Python 3 grows older, 
there is potentially more code being written that you break by fixing a bug 
like this. It is incompatible if you used to write

>>> print(struct.Struct('hi').format.decode())
hi

I have used this decode() trick in the past to build composite format strings; 
e.g.: . If you change the data 
type this code will raise AttributeError. At a minimum you should acknowledge 
it in the “porting” section of What’s New.

Also, if you make this change, maybe update the module doc string. See the end 
of format-str.patch.

--

___
Python tracker 

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



[issue29899] zlib missing when --enable--optimizations option appended

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

Strange, I don't see any obvious error related to the C "z" lib or to the 
Python "zlib" module.

Example on my system:

haypo@selma$ python3
Python 3.5.2 (default, Sep 14 2016, 11:28:32) 
[GCC 6.2.1 20160901 (Red Hat 6.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zlib
>>> zlib

>>> 
haypo@selma$ ldd 
/usr/lib64/python3.5/lib-dynload/zlib.cpython-35m-x86_64-linux-gnu.so
linux-vdso.so.1 (0x7fff22f2e000)
libz.so.1 => /lib64/libz.so.1 (0x7f88e1fe)
libpython3.5m.so.1.0 => /lib64/libpython3.5m.so.1.0 (0x7f88e1b13000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x7f88e18f5000)
libc.so.6 => /lib64/libc.so.6 (0x7f88e152f000)
libdl.so.2 => /lib64/libdl.so.2 (0x7f88e132b000)
libutil.so.1 => /lib64/libutil.so.1 (0x7f88e1126000)
libm.so.6 => /lib64/libm.so.6 (0x7f88e0e1d000)
/lib64/ld-linux-x86-64.so.2 (0x55d00b915000)
haypo@selma$ ldd 
/usr/lib64/python3.5/lib-dynload/zlib.cpython-35m-x86_64-linux-gnu.so^C
haypo@selma$ ls -l /lib64/libz.so.1
lrwxrwxrwx. 1 root root 13  5 févr.  2016 /lib64/libz.so.1 -> libz.so.1.2.8

Can you check if you have a "zlib.(...).so" file in 
/usr/lib64/python3.5/lib-dynload/? (ajust to the right directory)

--

___
Python tracker 

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



[issue29899] zlib missing when --enable--optimizations option appended

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

See also the issue #29641 "make install failure when using ./configure 
--enable-optimizations".

--

___
Python tracker 

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



[issue21071] struct.Struct.format is bytes, but should be str

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

Ok, I opened a thread on python-dev:
https://mail.python.org/pipermail/python-dev/2017-March/147688.html

Martin: "At a minimum you should acknowledge it in the “porting”
section of What’s New."

I wasn't sure if the change was worth it to be mentionned in What's
New in Python 3.7. Ok, will do for the next round (I'm now waiting for
more feedback on my python-dev thread and this issue.)

--

___
Python tracker 

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



[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, you are right. I don't know whether Python supports such platform after 
dropping support of DOS.

But in any case I don't see any issue here.

Oren will be not active until August, so we should make the decision about 
closing the issue or changing the code without him.

--

___
Python tracker 

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



[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

The 3.5, 3.6 and master branches of Python have a new sys._git attribute and 
lost their sys._mercurial attribute. But the 2.7 branch is still stuck at 
sys._mercurial: version and tag are empty.

Should we backport sys._git from master to 2.7 and remove sys._mercurial? Maybe 
on 2.7 we can keep sys._mercurial.

--
nosy: +haypo

___
Python tracker 

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



[issue29918] Missed "const" modifiers in C API documentation

2017-03-27 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

I closed the issue.

@Oren: Please reopen the issue with a pull request if you consider that the 
assertion is worth it.

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



[issue29912] Overlapping tests between list_tests and seq_tests

2017-03-27 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
pull_requests: +745

___
Python tracker 

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



[issue29893] create_subprocess_exec doc doesn't match software

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

Ah, I wrote "def create_subprocess_exec(program, *args," to implicitly check 
that args is non empty.

We can either change the function prototype to check that args is non-empty in 
the body, or just update the documentation.

The documentation is not exactly wrong :-)

--
nosy: +haypo

___
Python tracker 

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



[issue29798] Handle "git worktree" in "make patchcheck"

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

Tools/scripts/patchcheck.py still checks isdir() in get_base_branch():

@status("Getting base branch for PR",
info=lambda x: x if x is not None else "not a PR branch")
def get_base_branch():
if not os.path.isdir(os.path.join(SRCDIR, '.git')):
# Not a git checkout, so there's no base branch
return None
...

Was it deliberate to not change this line?

--
nosy: +haypo

___
Python tracker 

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



[issue29887] test_normalization doesn't work

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

http://www.pythontest.net/unicode/7.0.0/NormalizationTest.txt exists, but not 
http://www.pythontest.net/unicode/8.0.0/NormalizationTest.txt nor 
http://www.pythontest.net/unicode/9.0.0/NormalizationTest.txt

Maybe the dev who upgrade Unicode to 8.0 and then 9.0 forgot to upload required 
files to the pythontest website?

I confirm that 8.0 and 9.0 lacks from 
https://github.com/python/pythontestdotnet/tree/master/www/unicode

--
nosy: +haypo

___
Python tracker 

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



[issue29840] Avoid raising OverflowError in bool()

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy: Can you please create a pull request? It would be easier to review.

--
nosy: +haypo

___
Python tracker 

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



[issue29919] Remove unused imports found by pyflakes

2017-03-27 Thread STINNER Victor

New submission from STINNER Victor:

Attached PR removes unused imports found by pyflakes. It makes also minor PEP 8 
coding style fixes on modified imports.

--
messages: 290607
nosy: haypo
priority: normal
pull_requests: 746
severity: normal
status: open
title: Remove unused imports found by pyflakes
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



[issue29920] Document cgitb.text and cgitb.html

2017-03-27 Thread Xavier Morel

New submission from Xavier Morel:

Currently, cgitb documents the hook (enable) and somewhat unclearly the ability 
to dump the HTML traceback to stdout, but despite that being technically 
available it does not document the ability to dump the traceback to a string as 
either text or html.

Possible further improvement: make ``cgitb.html`` and ``cgitb.text`` implicitly 
call `sys.exc_info()` if not given a parameter (much like `cgitb.handler` does).

--
assignee: docs@python
components: Documentation
messages: 290608
nosy: docs@python, xmorel
priority: normal
pull_requests: 747
severity: normal
status: open
title: Document cgitb.text and cgitb.html
type: enhancement
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



[issue29921] datetime validation is stricter in 3.6.1 than previous versions

2017-03-27 Thread m-parry

New submission from m-parry:

The change in issue #29100 - intended AFAICS simply to fix a regression in 3.6 
- seems to have made datetime validation via certain code paths stricter than 
it was in 2.7 or 3.5. I think it's the case that some routes via the C API now 
reject out of range values that were previously permitted. Even if this 
previous behaviour was incorrect, was it intentional to alter that in a 
maintenance release?

Here's a quick example using pywin32:

---

> import getpass, sspi, sspicon, win32security
> client_name = getpass.getuser()
> auth_info = (client_name, 'wherever.com', None)
> pkg_info = win32security.QuerySecurityPackageInfo('Kerberos')
> win32security.AcquireCredentialsHandle(
> client_name, pkg_info['Name'],
> sspicon.SECPKG_CRED_OUTBOUND,
> None, auth_info)

ValueError: year 30828 is out of range

---

Of course, this is probably a mishandling of the 'never expires' value returned 
by the Windows API in this case, and indeed I have also created a pywin32 
ticket. However, I'm guessing that the linked issue wasn't supposed to break 
such code.

--
components: Library (Lib)
messages: 290609
nosy: m-parry
priority: normal
severity: normal
status: open
title: datetime validation is stricter in 3.6.1 than previous versions
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29920] Document cgitb.text and cgitb.html

2017-03-27 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


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



[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-27 Thread Steve Dower

Steve Dower added the comment:

It needs to be backported there too, or we need to unmigrate 2.7 back to 
mercurial. Otherwise we can't make a release.

--

___
Python tracker 

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



[issue29908] Inconsistent crashing with an access violation

2017-03-27 Thread Steve Dower

Steve Dower added the comment:

Do you have a reference to an issue from their side about this? Python should 
never crash due to pure Python code, so we'd like to be able to prevent this in 
the future.

--

___
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-03-27 Thread Xavier Morel

Xavier Morel added the comment:

PR targetted to master rather than 2.7

--
pull_requests: +748

___
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-03-27 Thread Xavier Morel

Changes by Xavier Morel :


--
pull_requests:  -747

___
Python tracker 

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



[issue26657] Directory traversal with http.server and SimpleHTTPServer on windows

2017-03-27 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +749

___
Python tracker 

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



[issue29919] Remove unused imports found by pyflakes

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:


New changeset d6debb24e06152a827769b0cac24c47deccdeac1 by Victor Stinner in 
branch 'master':
bpo-29919: Remove unused imports found by pyflakes (#137)
https://github.com/python/cpython/commit/d6debb24e06152a827769b0cac24c47deccdeac1


--

___
Python tracker 

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



[issue29919] Remove unused imports found by pyflakes

2017-03-27 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue29783] Modify codecs.open() to use the io module instead of codecs.StreamReaderWriter()

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

I abandonned my pull request.

--

___
Python tracker 

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



[issue27425] Tests fail because of git's newline preferences on Windows

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:


New changeset cf57fe13b44e3994096ae79f32c11475f333a94f by Victor Stinner in 
branch '3.5':
bpo-27425: Add .gitattributes, fix Windows tests (#844)
https://github.com/python/cpython/commit/cf57fe13b44e3994096ae79f32c11475f333a94f


--

___
Python tracker 

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



[issue29840] Avoid raising OverflowError in bool()

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This issue depends on issue29839. Tests are failed until the patch of 
issue29839 is merged.

--

___
Python tracker 

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



[issue19824] string.Template: Rewrite docs to emphasize i18n use case

2017-03-27 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
assignee: docs@python -> barry

___
Python tracker 

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



[issue19824] string.Template: Rewrite docs to emphasize i18n use case

2017-03-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

I'll take this one, and see if I can address 20314 also.

--

___
Python tracker 

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



[issue29919] Remove unused imports found by pyflakes

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
nosy: +serhiy.storchaka
stage:  -> commit review

___
Python tracker 

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



[issue20552] Use specific asserts in bytes tests

2017-03-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Close?

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



[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

The change is an optimization, so it requires a benchmark, think you provided. 
Ok. But the speedup is a few nanoseconds on a function which takes currently 40 
nanoseconds. It's not really what I would call significant:

$ ./python -m perf compare_to ref.json patch.json  --table
+-+-+-+
| Benchmark   | ref | patch   |
+=+=+=+
| int==float 8 digits | 39.2 ns | 37.9 ns: 1.03x faster (-3%) |
+-+-+-+
| int==float 1 digit  | 38.0 ns | 37.9 ns: 1.00x faster (-0%) |
+-+-+-+
| int.bit_length()| 42.0 ns | 41.2 ns: 1.02x faster (-2%) |
+-+-+-+

(See attached bench_bit_length.py script.)

So I'm not really convinced that the change is useful. Is bit_length() used in 
hot loops?

--
nosy: +haypo
Added file: http://bugs.python.org/file46759/bench_bit_length.py

___
Python tracker 

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



[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

> $ ./python -m timeit "12345678 == 12345678.0"
> 500 loops, best of 5: 40 nsec per loop

By the way, I check the bytecode to make sure that the compiler doesn't 
optimize that. I'm suprised that it's not replaced with True!

Is there a reason to perform the test at runtime?

--

___
Python tracker 

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



[issue29921] datetime validation is stricter in 3.6.1 than previous versions

2017-03-27 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +haypo

___
Python tracker 

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



[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are not good reasons to optimize this case at compile time. This is very 
obscure way of writing True.

--

___
Python tracker 

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



[issue29915] Drop Mac OS X Tiger support in Python 3.7?

2017-03-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Is there any downside to keeping this code?

--
nosy: +rhettinger

___
Python tracker 

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



[issue28718] '*' matches entire path in fnmatch

2017-03-27 Thread Aaron Whitehouse

Aaron Whitehouse added the comment:

Posted to the [Python-ideas] mailing list, as it is proposing a change to a 
standard library:
https://mail.python.org/pipermail/python-ideas/2017-February/044880.html

Nobody has responded so far, however. I take this as at least no vehement 
objection to the idea.

--

___
Python tracker 

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



[issue29915] Drop Mac OS X Tiger support in Python 3.7?

2017-03-27 Thread Ned Deily

Ned Deily added the comment:

>The Tiger buildbot fails since many years:
>http://buildbot.python.org/all/builders/x86%20Tiger%203.x/builds/479/steps/test/logs/stdio

That's not true.  The one failing test, test_uuid, was just added last month.  
Note that the 3.5 Tiger buildbot has not test failures.

So, one question that perhaps you and Barry can answer is what is the 
significance of that failure.

>It doesn't seem like anyone take care of this buildbot.

That's also not true.  David Bolen, the owner of the buildbot, is very 
responsive to requests for updates of third-party libraries on the buildbot.

Getting back to the support of OS X 10.4, to the best of my knowledge we 
currently do not document anywhere exactly what levels of OS X we support.  We 
could do that and, yes, we could explicitly drop support for 10.4.  However, at 
the moment, there just seems to be this one issue which we should understand 
better before deciding anything.  But, more importantly, at the moment, the 
10.4 Tiger buildbot is the *only* working Mac buildbot we have.  Two other Mac 
buildbots we've had, the "Snow Leopard" and "Yosemite" buildbots have been 
off-line for many months.  Until we have other working OS X buildbots, the 
Tiger one should remain.  It is serving a useful purpose.

--
nosy: +barry

___
Python tracker 

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



[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-27 Thread Ned Deily

Ned Deily added the comment:

I'll be doing backports to 2.7 for this and some other things shortly.

--

___
Python tracker 

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



[issue29572] Upgrade installers to OpenSSL 1.0.2k

2017-03-27 Thread Ned Deily

Ned Deily added the comment:

> It seems like all pull requests are merged. Can the issue be closed now?

Not quite yet.

--

___
Python tracker 

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



[issue24739] allow argparse.FileType to accept newline argument

2017-03-27 Thread AlbertZhuang

Changes by AlbertZhuang :


--
pull_requests: +750

___
Python tracker 

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



[issue29915] Drop Mac OS X Tiger support in Python 3.7?

2017-03-27 Thread Ned Deily

Ned Deily added the comment:

Here's where the Tiger 3.x buildbot started failing:

http://buildbot.python.org/all/builders/x86%20Tiger%203.x/builds/363

with this commit 0b8432538acf45d7a605fe68648b4712e8d9cee3

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue19382] tabnanny unit tests

2017-03-27 Thread Jaysinh shukla

Changes by Jaysinh shukla :


--
pull_requests: +751

___
Python tracker 

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



[issue29506] Incorrect documentation for the copy module

2017-03-27 Thread R. David Murray

R. David Murray added the comment:

Looking over the PR, and especially in the context of Serhiy's point about this 
being about 'deep copy' and not 'deepcopy', I think this would be clearer if it 
were shortened even further, to just:

"Because deep copy copies everything, it may copy data that is intended to be 
shared between copies."

After all, what deepcopy does it provide a way for a class to implement that 
sharing when a deepcopy is done.

--

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2017-03-27 Thread Tadhg McDonald-Jensen

New submission from Tadhg McDonald-Jensen:

When creating a asynchronous context manager if the __aexit__ method is not 
labeled as async (so it returns None instead of a coroutine) the error has a 
generic error message:

TypeError: object NoneType can't be used in 'await' expression

Would it be possible to change this so it indicates that it was the context 
that was invalid not an `await` statement?  Since the traceback points to the 
last statement of the with block it can create very confusing errors if the 
last statement was an await.

Example:

import asyncio
class Test():
async def __aenter__(self):
print("aenter used")
value = asyncio.Future()
value.set_result(True)
return value
#FORGOT TO MARK AS async !!
def __aexit__(self, *errors):
print("aexit used")
return None

async def my_test():
async with Test() as x:
print("inside async with, now awaiting on", x)
await x

my_test().send(None)

Give the output:

aenter used
inside async with, now awaiting on 
aexit used
Traceback (most recent call last):
  File ".../test.py", line 19, in 
my_test().send(None)
  File ".../test.py", line 16, in my_test
await x
TypeError: object NoneType can't be used in 'await' expression

Which indicates to me that `x` was None when it was await-ed for.

--
components: asyncio
messages: 290630
nosy: Tadhg McDonald-Jensen, yselivanov
priority: normal
severity: normal
status: open
title: error message when __aexit__ is not async
type: behavior
versions: Python 2.7, 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



[issue25538] Traceback from __exit__ method is misleading

2017-03-27 Thread R. David Murray

R. David Murray added the comment:

See also issue 29922.

--
nosy: +Tadhg McDonald-Jensen, yselivanov

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2017-03-27 Thread R. David Murray

R. David Murray added the comment:

This is a specific example of the general problem reported in issue 25538.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Traceback from __exit__ method is misleading

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2017-03-27 Thread Yury Selivanov

Yury Selivanov added the comment:

> This is a specific example of the general problem reported in issue 25538.

It's a bit different code path/problem.  But I agree, we should work on making 
both `with` and `async with` a bit more usable.

> Would it be possible to change this so it indicates that it was the context 
> that was invalid not an `await` statement?

I'm not sure if we can do anything about this.  We compile 'async with' into a 
set of opcodes.  The first ones resolve __aexit__, the latter ones await on it. 
The one that prepares to await on the aexit (GET_AWAITABLE) is the same that 
'await' expression compiles to, and that opcode has no idea what exactly it 
awaits on.

We could probably add GET_AEXIT_AWAITABLE opcode specifically to improve the 
error message (other than that it would be a copy of GET_AWAITABLE). I'll think 
about it.

--
assignee:  -> yselivanov

___
Python tracker 

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



[issue11913] sdist refuses README.rst

2017-03-27 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
resolution: wont fix -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue29894] Deprecate returning a subclass of complex from __complex__

2017-03-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue29917] Wrong link target in PyMethodDef documentation

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Agree. I noticed this when making a review of PR 831, but forgot to open an 
issue.

--
nosy: +serhiy.storchaka
stage:  -> needs patch
type:  -> behavior
versions: +Python 2.7, 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



[issue29144] Implicit namespace packages in Python 3.6

2017-03-27 Thread Charalampos Stratakis

Charalampos Stratakis added the comment:

Bumped upon a similar issue today where a package I was working on couldn't 
import a module from one of its dependencies (which was not the case in python 
3.5).

One of the lines that fail is this [0] with:
ModuleNotFoundError: No module named 'repoze.who._compat'

And the project that it depends on is this [1]

The projects are old, however what might have caused this behavior change? It 
seems kinda isolated but that the exact cause has not been pinpointed.

[0] 
https://github.com/repoze/repoze.who-sqlalchemy/blob/master/tests/databasesetup_elixir.py#L25
[1] https://github.com/repoze/repoze.who/tree/master/repoze/who

--
nosy: +cstratak

___
Python tracker 

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



[issue29887] test_normalization doesn't work

2017-03-27 Thread Brett Cannon

Brett Cannon added the comment:

Benjamin did the update to 9.0.0.

We should probably update Tools/unicode/makeunicodedata.py to print out in the 
end that the appropriate file needs to be added to pythontest.net **before** 
merging an update to unicodedata.

--

___
Python tracker 

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



[issue29878] Add global instances of int 0 and 1

2017-03-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +752

___
Python tracker 

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



[issue29867] Add asserts in PyXXX_GET_SIZE macros

2017-03-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It would be enough to compile them. New macros produce compiler error when used 
as lvalue.

But I afraid it will take too much time on my netbook.

--

___
Python tracker 

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



[issue29912] Overlapping tests between list_tests and seq_tests

2017-03-27 Thread Brett Cannon

Brett Cannon added the comment:


New changeset d702c50049207d825c1d5925fbc7306514fa9a0a by Brett Cannon (Jim 
Fasarakis-Hilliard) in branch 'master':
bpo-29912: Remove redundant tests in list_tests that are found in seq_tests 
(GH-847)
https://github.com/python/cpython/commit/d702c50049207d825c1d5925fbc7306514fa9a0a


--
nosy: +brett.cannon

___
Python tracker 

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



[issue29912] Overlapping tests between list_tests and seq_tests

2017-03-27 Thread Brett Cannon

Changes by Brett Cannon :


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



[issue1234] semaphore errors on AIX 5.2

2017-03-27 Thread Michael Seifert

Changes by Michael Seifert :


--
pull_requests: +753

___
Python tracker 

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



[issue11913] sdist refuses README.rst

2017-03-27 Thread Ryan Gonzalez

Changes by Ryan Gonzalez :


--
pull_requests: +754

___
Python tracker 

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



[issue1234] semaphore errors on AIX 5.2

2017-03-27 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2017-03-27 Thread Tadhg McDonald-Jensen

Tadhg McDonald-Jensen added the comment:

> This is a specific example of the general problem reported in issue 25538.

Definitely related, although the part of giving an error "... can't be used in 
'await' expression" when no await expression is used isn't covered by that 
thread so I'm not sure I'd call this a direct duplicate.


Currently when __anext__ return a non-awaitable this error is shown:

TypeError: 'async for' received an invalid object from __anext__: NoneType

So having __aenter__ and __aexit__ have similar error messages would be nice.

Would it maybe make sense to implement this as adding an argument to 
GET_AWAITABLE to indicate whether it was called from await, __anext__, 
__aenter__ or __aexit__? (or others that may exist in future)  I don't know 
enough about bytecode to know how it'd compare to an instruction for each case.

--

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2017-03-27 Thread Yury Selivanov

Changes by Yury Selivanov :


--
resolution: duplicate -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue29922] error message when __aexit__ is not async

2017-03-27 Thread Yury Selivanov

Yury Selivanov added the comment:

> Would it maybe make sense to implement this as adding an argument to 
> GET_AWAITABLE to indicate whether it was called from await, __anext__, 
> __aenter__ or __aexit__?

Yes, but it will make it a tad slower (which will also affect await 
performance).  I'll run some benchmarks.

--

___
Python tracker 

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



  1   2   >