[issue32969] Add more constants to zlib module

2018-02-28 Thread Xiang Zhang

New submission from Xiang Zhang :

Inspired by https://github.com/python/cpython/pull/5511, zlib module in Python 
lacks some constants exposed by C zlib library, and some constants are not 
documented.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 313053
nosy: docs@python, xiang.zhang
priority: normal
severity: normal
status: open
title: Add more constants to zlib module
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue32864] Visual glitches when animating ScrolledText instances using place geometry manager

2018-02-28 Thread Victor Domingos

Victor Domingos  added the comment:

The new beta (Python 3.7.0b2 with Tcl/tk 8.6.8) seems to have that issue 
solved. Nice! :)

--

___
Python tracker 

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



[issue32818] multiprocessing segmentfault under Windows compatibility mode

2018-02-28 Thread Ma Lin

Ma Lin  added the comment:

3.7.0 beta2 still segmentfault.
Finer, please have a look.

segmentfault conditions:
64bit Windows 10 (1709) + 32bit Python 3.7.0 Beta2 + Compatibility Mode enabled.
(64bit Python doesn't segmentfault)

--
nosy: +Segev Finer

___
Python tracker 

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



[issue29456] bugs in unicodedata.normalize: u1176, u11a7 and u11c3

2018-02-28 Thread Ma Lin

Ma Lin  added the comment:

ping, this was forgotten.

--
nosy: +Ma Lin

___
Python tracker 

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



[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args

2018-02-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31013] gcc7 throws warning when pymem.h development header is used

2018-02-28 Thread Petr Viktorin

Petr Viktorin  added the comment:

This is a duplicate of https://bugs.python.org/issue31474
which was fixed in https://github.com/python/cpython/pull/3581
It should be included in the next Python 2.7.x release.

--
nosy: +encukou

___
Python tracker 

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



[issue32732] LoggingAdapter ignores extra kwargs of Logger#log()

2018-02-28 Thread Cyril Martin

Cyril Martin  added the comment:

Hi Stéphane,

I ask you a question about the change you suggest.
The PR has not progress. Do you wait something from me?

--

___
Python tracker 

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



[issue32732] LoggingAdapter ignores extra kwargs of Logger#log()

2018-02-28 Thread Berker Peksag

Change by Berker Peksag :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-02-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

I'm not quite sure why `Fraction_instance % float_instance` wouldn't simply 
convert the `Fraction` to a `float` and then use the usual floating-point mod. 
There's the issue that you want to maintain consistency with the floordiv 
operation, but if `Fraction_instance // float_instance` _also_ converts its 
first argument to float, then that consistency should follow automatically.

That's the pattern that's followed for most of the other binary arithmetic 
operators. It looks like the inconsistency is caused by using 
`_operator_fallbacks` for most of the operations, but doing something more 
ad-hoc for modulo.

I agree that the current behaviour is surprising.

--

___
Python tracker 

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



[issue32970] Improve disassembly of the MAKE_FUNCTION instruction

2018-02-28 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The proposed PR adds decryption of the MAKE_FUNCTION argument (it is a bits 
set) in the disassembler output. For example:

$ echo 'def f(x, y=1, *, z=2): ...' | ./python -m dis
  1   0 LOAD_CONST   6 ((1,))
  2 LOAD_CONST   1 (2)
  4 LOAD_CONST   2 (('z',))
  6 BUILD_CONST_KEY_MAP  1
  8 LOAD_CONST   3 (", line 1>)
 10 LOAD_CONST   4 ('f')
 12 MAKE_FUNCTION3 (defaults, kwdefaults)
 14 STORE_NAME   0 (f)
 16 LOAD_CONST   5 (None)
 18 RETURN_VALUE

Disassembly of ", line 1>:
  1   0 LOAD_CONST   0 (None)
  2 RETURN_VALUE

--
components: Library (Lib)
messages: 313060
nosy: ncoghlan, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Improve disassembly of the MAKE_FUNCTION instruction
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue32970] Improve disassembly of the MAKE_FUNCTION instruction

2018-02-28 Thread Serhiy Storchaka via Python-bugs-list

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue31013] gcc7 throws warning when pymem.h development header is used

2018-02-28 Thread Ned Deily

Change by Ned Deily :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> [2.7] Fix  -Wnonnull and -Wint-in-bool-context warnings

___
Python tracker 

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



[issue32971] unittest.TestCase.assertRaises

2018-02-28 Thread NODA, Kai

New submission from NODA, Kai :

https://docs.python.org/dev/library/unittest.html#unittest.TestCase.assertRaises

> If only the exception and possibly the msg arguments are given, return a 
> context manager so that the code under test can be written inline rather than 
> as a function:
> 
> with self.assertRaises(SomeException):
  do_something()
> 
> When used as a context manager, assertRaises() accepts the additional keyword 
> argument msg.

Perhaps we don't need the second sentence on the `msg` argument which isn't 
adding anything new.

Ideally it should be more clear when the method operates in context manager 
mode.
("If only" and "possibly" don't play nicely together.)
Maybe along the lines of "If no callable was passed as an argument ..." ? I 
haven't looked in to the actual implementation yet...

--
assignee: docs@python
components: Documentation
messages: 313061
nosy: docs@python, nodakai
priority: normal
severity: normal
status: open
title: unittest.TestCase.assertRaises
versions: Python 3.8

___
Python tracker 

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



[issue32971] Docs on unittest.TestCase.assertRaises() should be improved

2018-02-28 Thread NODA, Kai

Change by NODA, Kai :


--
title: unittest.TestCase.assertRaises -> Docs on 
unittest.TestCase.assertRaises() should be improved

___
Python tracker 

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



[issue32971] Docs on unittest.TestCase.assertRaises() should be improved

2018-02-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue13830] codecs error handler is called with a UnicodeDecodeError with the same args

2018-02-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

For reference, this behavior was from beginning, since implementing PEP 293 in 
issue432401.

--

___
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-02-28 Thread John Andersen

New submission from John Andersen :

This makes unittest TestCase classes run `test_` methods which are async

--
components: Tests, asyncio
messages: 313063
nosy: asvetlov, pdxjohnny, yselivanov
priority: normal
pull_requests: 5708
severity: normal
status: open
title: unittest.TestCase coroutine support
type: behavior
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



[issue32973] Importing the same extension module under multiple names breaks non-reinitialisable extension modules

2018-02-28 Thread Thomas Wouters

New submission from Thomas Wouters :

This is a continuation, of sorts, of issue16421; adding most of that issue's 
audience to the noisy list.

When importing the same extension module under multiple names that share the 
same basename, Python 3 will call the extension module's init function multiple 
times. With extension modules that do not support re-initialisation, this 
causes them to trample all over their own state. In the case of numpy, this 
corrupts CPython internal data structures, like builtin types.

Simple reproducer:
% python3.6 -m venv numpy-3.6
% numpy-3.6/bin/python -m pip install numpy
% PYTHONPATH=./numpy-3.6/lib/python3.6/site-packages/numpy/core/ 
./numpy-3.6/bin/python -c "import numpy.core.multiarray, multiarray; u'' < 1"
Traceback (most recent call last):
  File "", line 1, in 
Segmentation fault

(The corruption happens because PyInit_multiarray initialises subclasses of 
builtin types, which causes them to share some data (e.g. tp_as_number) with 
the base class: 
https://github.com/python/cpython/blob/master/Objects/typeobject.c#L5277. 
Calling it a second time then copies data from a different class into that 
shared data, corrupting the base class: 
https://github.com/python/cpython/blob/master/Objects/typeobject.c#L4950. The 
Py_TPFLAGS_READY flag is supposed to protect against this, but 
PyInit_multiarray resets the tp_flags value. I ran into this because we have 
code that vendors numpy and imports it in two different ways.)

The specific case of numpy is somewhat convoluted and exacerbated by dubious 
design choices in numpy, but it is not hard to show that calling an extension 
module's PyInit function twice (if the module doesn't support reinitialisation 
through PEP 3121) is bad: any C globals initialised in the PyInit function will 
be trampled on.

This was not a problem in Python 2 because the extension module cache worked 
based purely on filename. It was changed in response to issue16421, but the 
intent there appears to be to call *different* PyInit methods in the same 
module. However, because PyInit functions are based off of the *basename* of 
the module, not the full module name, a different module name does not mean a 
different init function name.

I think the right approach is to change the extension module cache to key on 
filename and init function name, although this is a little tricky: the init 
function name is calculated much later in the process. Alternatively, key it on 
filename and module basename, rather than full module name.

--
messages: 313064
nosy: Arfrever, amaury.forgeotdarc, asvetlov, brett.cannon, eric.snow, eudoxos, 
ncoghlan, pitrou, r.david.murray, twouters, vstinner
priority: normal
severity: normal
status: open
title: Importing the same extension module under multiple names breaks 
non-reinitialisable extension modules
type: behavior

___
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-02-28 Thread R. David Murray

R. David Murray  added the comment:

In order for this to be actually useful, I think we also need a mechanism to 
set up and run async cleanup methods.  In my own project I accomplish this by 
putting the run_until_complete in a try/finally loop and have an 
asyncAddCleanup method that just appends coroutines to a list that are then run 
in reversed order in the finally clause.

Whatever we come up with needs tests and docs, and before that, I'm sure, more 
discussion about the API.  Probably a topic for python-ideas?  Or the testing 
sig?

I really do think we should have async test support in the stdlib, though.  
Basic support isn't that hard (it's 15 lines in the test suite I'm using 
currently).

--
nosy: +r.david.murray
type: behavior -> enhancement
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-02-28 Thread John Andersen

John Andersen  added the comment:

More discussion indeed. I figured I was not alone in my desire to see async 
test support in the stdlib. Let me know what other changes would be good.

--

___
Python tracker 

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



[issue32964] Reuse a testing implementation of the path protocol in tests

2018-02-28 Thread Brett Cannon

Brett Cannon  added the comment:

FakePath? Otherwise SimplePath seems as good a name as any other one.

--

___
Python tracker 

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



[issue32940] IDLE: pyparse - simplify StringTranslatePseudoMapping

2018-02-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Replacing an expression with a less clear equivalent expression makes no sense 
to me.  Anyway, having __missing__ return 120 reduces the benchmark miss time 
from 1.2-1.3 to .93, making ParseMis always faster than ParseGet and reducing 
the penalty for non-ascii chars.

re.sub + str.replace is slower than translate

import re
import timeit

class ParseMap(dict):
def __missing__(self, key): return 120  # ord('x')

trans = ParseMap((i,120) for i in range(128))
trans.update((ord(c), ord('(')) for c in "({[")
trans.update((ord(c), ord(')')) for c in ")}]")
trans.update((ord(c), ord(c)) for c in "\"'\\\n#")

trans_re = re.compile(r'''[^(){}\[]"'\\\n#]+''')
code='\t a([{b}])b"c\'d\n'*1000  # n = 1, 10, 100, 1000

print(timeit.timeit(
'code.translate(trans)',
number=1, globals = globals()))
print(timeit.timeit(
"code1 = trans_re.sub('x', code)\n"
"code2 = code1.replace('{', '(')\n"
"code3 = code2.replace('}', ')')\n"
"code4 = code3.replace('[', '(')\n"
"code5 = code4.replace(']', '(')\n"
r"code6 = code5.replace('\nx', '\n')",
number=1, globals = globals()))

n trans   re
1  .06.09 
10 .08.17
100.28   1.00
1000  2.28.9

Multiply by 100 to get microseconds or seconds for 100.

--

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2018-02-28 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5709

___
Python tracker 

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



[issue32878] Document value of st_ino on Windows

2018-02-28 Thread Alexander Nelson

Alexander Nelson  added the comment:

Thank you for this fix.

--
nosy: +Alexander Nelson

___
Python tracker 

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



[issue32732] LoggingAdapter ignores extra kwargs of Logger#log()

2018-02-28 Thread Vinay Sajip

Vinay Sajip  added the comment:

This is not a bug, so I have closed the PR and am closing the issue. You might 
expect extras to be merged, but you can either pass extras in the constructor 
(as you have observed) or by subclassing LoggerAdapter and overriding the 
process method to do what you need.

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



[issue32940] IDLE: pyparse - simplify StringTranslatePseudoMapping

2018-02-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The mapping passed to str.translate must map ints representing codepoints to 
either either ints or strings.  Translate can extract binary codepoints for the 
new string from either. Ints are slightly faster, so I am inclined not to 
switch.

import timeit

class ParseMapN(dict):
def __missing__(self, key): return 120
class ParseMapS(dict):
def __missing__(self, key): return 'x'

trans1 = ParseMapN.fromkeys(range(128), 120)
trans1.update((ord(c), ord('(')) for c in "({[")
trans1.update((ord(c), ord(')')) for c in ")}]")
trans1.update((ord(c), ord(c)) for c in "\"'\\\n#")

trans2 = ParseMapN.fromkeys(range(128), 'x')
trans2.update((ord(c), '(') for c in "({[")
trans2.update((ord(c), ')') for c in ")}]")
trans2.update((ord(c), c) for c in "\"'\\\n#")

for i in (1, 10, 100, 1000):
code = '\t a([{b}])b"c\'d\n' * i
print('N ', i)
print(timeit.repeat(
'code.translate(trans1)',
number=1, globals = globals()))
print('S ', i)
print(timeit.repeat(
'code.translate(trans2)',
number=1, globals = globals()))
 
N   1 [0.056562504, 0.056747570, 0.05654651,  0.056460749, 0.056428776]
S   1 [0.060795346, 0.062304155, 0.061043432, 0.062349345, 0.061191301]

N  10 [0.076474600, 0.076463227, 0.076560984, 0.076581582, 0.076010091]
S  10 [0.080739106, 0.080798745, 0.08034192,  0.080987501, 0.080617369]

N 100 [0.28529922,  0.28383868,  0.283949046, 0.284461512, 0.284291203]
S 100 [0.289629521, 0.288535418, 0.289154560, 0.28811548,  0.28862180]

N1000 [2.23882157,  2.2383192,   2.2384120,   2.2377972,   2.23854982]
S1000 [2.24242237,  2.2426845,   2.2424623,   2.2420030,   2.24254871]

The pattern of all S repeats being greater than all corresponding N repeats was 
true for 2 other runs.

--

___
Python tracker 

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



[issue32940] IDLE: pyparse - simplify StringTranslatePseudoMapping

2018-02-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset f0daa880a405c8de6743e44fa46006754aa145c9 by Terry Jan Reedy 
(Cheryl Sabella) in branch 'master':
bpo-32940: IDLE: Simplify StringTranslatePseudoMapping in pyparse (GH-5862)
https://github.com/python/cpython/commit/f0daa880a405c8de6743e44fa46006754aa145c9


--

___
Python tracker 

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



[issue32940] IDLE: pyparse - simplify StringTranslatePseudoMapping

2018-02-28 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5711

___
Python tracker 

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



[issue32940] IDLE: pyparse - simplify StringTranslatePseudoMapping

2018-02-28 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5710
stage: needs patch -> patch review

___
Python tracker 

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



[issue32940] IDLE: pyparse - simplify StringTranslatePseudoMapping

2018-02-28 Thread miss-islington

miss-islington  added the comment:


New changeset 7e5763469e2fc9d08a3f6b6205f87f20a1bdd465 by Miss Islington (bot) 
in branch '3.7':
bpo-32940: IDLE: Simplify StringTranslatePseudoMapping in pyparse (GH-5862)
https://github.com/python/cpython/commit/7e5763469e2fc9d08a3f6b6205f87f20a1bdd465


--
nosy: +miss-islington

___
Python tracker 

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



[issue32940] IDLE: pyparse - simplify StringTranslatePseudoMapping

2018-02-28 Thread miss-islington

miss-islington  added the comment:


New changeset 32f5392f64f004382e26a988b1145d2dc96c4978 by Miss Islington (bot) 
in branch '3.6':
bpo-32940: IDLE: Simplify StringTranslatePseudoMapping in pyparse (GH-5862)
https://github.com/python/cpython/commit/32f5392f64f004382e26a988b1145d2dc96c4978


--

___
Python tracker 

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



[issue32953] Dataclasses: frozen should not be inherited for non-dataclass derived classes

2018-02-28 Thread Eric V. Smith

Eric V. Smith  added the comment:

See https://mail.python.org/pipermail/python-dev/2018-February/152320.html for 
a discussion.

--
title: Dataclasses: frozen should not be inherited -> Dataclasses: frozen 
should not be inherited for non-dataclass derived classes

___
Python tracker 

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



[issue32973] Importing the same extension module under multiple names breaks non-reinitialisable extension modules

2018-02-28 Thread Gregory P. Smith

Change by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue32973] Importing the same extension module under multiple names breaks non-reinitialisable extension modules

2018-02-28 Thread Gregory P. Smith

Change by Gregory P. Smith :


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



[issue32963] Python 2.7 tutorial claims source code is UTF-8 encoded

2018-02-28 Thread Brett Cannon

Brett Cannon  added the comment:

https://docs.python.org/2.7/tutorial/interpreter.html#source-code-encoding if 
people are looking for the doc link.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue32974] Add bitwise operations and other missing comparison methods to Python's IP address module

2018-02-28 Thread Kyle Agronick

New submission from Kyle Agronick :

I've recently had the experience of implementing a system for managing DNS 
records at a Fortune 10 company with ~10,000 stores. There were a number of 
things that I felt were missing from the IP address module and could be added 
without introducing any breaking changes.

The easiest changes I saw would be to implement bitwise operations without 
casting all the addresses to ints and then back to IP addresses.

Lets say you wanted to take the last octet from one address and put it on 
another:

Right now you need to do:
IPv6Address(int(v6('2001:db8:85a3:0:0:8a2e:370:7334')) & 
int(IPv6Address('0:0:0:0:0:0:0:')) | 
int(IPv6Address('1323:cf3:23df:0:0:32:44:0')))
# returns IPv6Address('1323:cf3:23df::32:44:7334')

You should be able to do:
(IPv6Address('2001:db8:85a3:0:0:8a2e:370:7334') & 
IPv6Address('0:0:0:0:0:0:0:')) | IPv6Address('1323:cf3:23df:0:0:32:44:0')
# returns TypeError: unsupported operand type(s) for &: 'IPv6Address' and 
'IPv6Address'

All that would be required is to do the casting to int automatically.

The other thing I saw that I would like would be to override the methods that 
return generators with iterables that provide more comparison operations.

Right now you can check if an IP is in a network with:
IPv4Address('192.168.1.12') in IPv4Network('192.168.1.0/24') 
# returns True

You should be able to do this with methods that return multiple networks.
ipaddress.summarize_address_range() is a method that returns a generator of 
IPv(4|6)Networks.

To see if an IP address is in one of multiple networks you need to do:
any(map(lambda i: IPv4Address('192.168.1.12') in i, 
ipaddress.summarize_address_range(IPv4Address('192.168.1.0'), 
IPv4Address('192.168.2.255'
# returns True

You should be able to do:
IPv4Address('192.168.1.12') in 
ipaddress.summarize_address_range(IPv4Address('192.168.1.0'), 
IPv4Address('192.168.2.255'))
# returns False

This should be the default for IPv(4|6)Addresses. IPv(4|6)Networks should check 
membership like they currently do.

You should be able to subtract ranges to make ranges that include some IPs but 
not others:
ipaddress.summarize_address_range(IPv4Address('192.168.1.0'), 
IPv4Address('192.168.2.255')) - 
ipaddress.summarize_address_range(IPv4Address('192.168.1.20'), 
IPv4Address('192.168.1.50'))
# returns TypeError: unsupported operand type(s) for -: 'generator' and 
'generator'

This should return a iterable that has networks that include 192.168.1.0 to 
192.168.1.20 and 192.168.1.50 to 192.168.2.255.

You should be able to do addition as well without casting to a list.

Methods like .hosts() should be able to be performed on the iterator instead of 
doing:
sum([list(i.hosts()) for i in 
ipaddress.summarize_address_range(IPv4Address('192.168.1.0'), 
IPv4Address('192.168.2.255'))], [])

do:
ipaddress.summarize_address_range(IPv4Address('192.168.1.0'), 
IPv4Address('192.168.2.255')).hosts()

Another great feature would be to allow division on networks and network 
generators giving you every xth host:
(i for i in IPv4Network('192.168.1.0/24').hosts() if int(i) % x == 0)

When x is 32 you get:
IPv4Address('192.168.1.32'), 
IPv4Address('192.168.1.64'), 
IPv4Address('192.168.1.96'), 
IPv4Address('192.168.1.128'), 
IPv4Address('192.168.1.160'), 
IPv4Address('192.168.1.192'), 
IPv4Address('192.168.1.224')

I would be happy to code this if the consensus was that this would be included.

--
components: Library (Lib)
messages: 313077
nosy: Kyle Agronick
priority: normal
severity: normal
status: open
title: Add bitwise operations and other missing comparison methods to Python's 
IP address module
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue8243] curses writing to window's bottom right position raises: `_curses.error: addstr() returned ERR'

2018-02-28 Thread Jay Crotts

Change by Jay Crotts :


--
versions: +Python 3.8 -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



[issue32974] Add bitwise operations and other missing comparison methods to Python's IP address module

2018-02-28 Thread bbayles

Change by bbayles :


--
nosy: +bbayles

___
Python tracker 

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



[issue32056] bug in Lib/wave.py

2018-02-28 Thread BT123

BT123  added the comment:

the bug still in the Python 3.7.0b2 - 2018-02-28

--
versions: +Python 3.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



[issue32056] bug in Lib/wave.py

2018-02-28 Thread zhangdeyue

zhangdeyue  added the comment:

The CVE email:
The CVE ID is below. Please check whether the vulnerability still
exists in Python 3.6.4, and please inform the software maintainer that
the CVE ID has been assigned: https://bugs.python.org

Use CVE-2017-18207 for this vulnerability in Python.

--

___
Python tracker 

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



[issue32974] Add bitwise operations and other missing comparison methods to Python's IP address module

2018-02-28 Thread Ned Deily

Change by Ned Deily :


--
nosy: +pmoody

___
Python tracker 

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



[issue32056] bug in Lib/wave.py

2018-02-28 Thread Ned Deily

Change by Ned Deily :


--
keywords: +security_issue -patch
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-02-28 Thread Elias Zamaria

Elias Zamaria  added the comment:

Mark, you have some good ideas. A fraction modulo a float is a float, and an 
integer modulo infinity produces itself as a float, so it seems reasonable that 
a fraction modulo infinity should be itself converted to a float.

I tried assigning __mod__ and __rmod__ using _operator_fallbacks, like most of 
the binary operators, and calculations involving infinity behaved as I 
expected, but one test failed (1.0 % Fraction(1, 10) was no longer 0 because of 
rounding error).

But then I tried assigning only __mod__ using _operator_fallbacks, and leaving 
__rmod__ alone, and all the tests passed (including some ones I added to make 
sure that modulo calculations involving infinity behave like both of us think 
they should).

As for the floordiv operator, I'm not sure what to think. It would be a bit 
strange if mod with a float returns a float and floordiv with a float returns 
an int. It wouldn't be a big deal IMO but it may be easy to change. I tried a 
simple change to make floordiv with a float to return a float, and changed one 
test to make sure that it works, and all of the tests passed.

I can make a pull request if anyone wants.

--

___
Python tracker 

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



[issue32975] mailbox: It would be nice to move mailbox.Message from legacy email.message.Message API to new EmailMessage API

2018-02-28 Thread Abhilash Raj

New submission from Abhilash Raj :

Since Python 3.6 the new EmailMessage API seems to be the default but 
mailbox.Message still subclasses from the old email.message.Message API.

It would be nice to get EmailMessage from mailbox so that one can rely on the 
new methods and content managers. Also, while it is possible to  pass a 
constructor to mailbox.mbox to get the new EmailMessage style message, it is 
different from mailbox.Message which has some extra methods.

--
components: email
messages: 313082
nosy: barry, maxking, r.david.murray
priority: normal
severity: normal
status: open
title: mailbox: It would be nice to move mailbox.Message from legacy 
email.message.Message API to new EmailMessage API
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue32975] mailbox: It would be nice to move mailbox.Message from legacy email.message.Message API to new EmailMessage API

2018-02-28 Thread Abhilash Raj

Abhilash Raj  added the comment:

I should also mention probably that I went ahead and made changes to make this 
work and I can pass most of the tests, one is failing due to missing `\n` 
character in the header's value obtained from `msg.get_all('Received')`.

I can make a pull request on Github if that would be a good place to start the 
discussion instead.

--

___
Python tracker 

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



[issue32056] Improve exceptions in Lib/wave.py

2018-02-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I have no idea why this was classified as a vulnerability. I don't think it can 
crash an application. If you have an example of crashing please provide it.

I would not classify this issue even as a bug. It is obvious that invalid files 
can cause an exception. It may be good to detect some of errors earlier and 
raise more specific exception (Error would be more appropriate here than 
ValueError). But in general validating the wave file is not the purpose of this 
module, and this task can't be performed without reading the whole file, not 
only the header.

All changes in wave.py should be ported to aifc.py and sunau.py and needs tests.

--
title: bug in Lib/wave.py -> Improve exceptions in Lib/wave.py
type: crash -> enhancement
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