[issue32829] Lib/ be more pythonic

2018-02-12 Thread Дилян Палаузов

New submission from Дилян Палаузов :

diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py
--- a/Lib/distutils/command/sdist.py
+++ b/Lib/distutils/command/sdist.py
@@ -251,14 +251,11 @@ class sdist(Command):
 for fn in standards:
 if isinstance(fn, tuple):
 alts = fn
-got_it = False
 for fn in alts:
 if self._cs_path_exists(fn):
-got_it = True
 self.filelist.append(fn)
 break
-
-if not got_it:
+else:
 self.warn("standard file not found: should have one of " +
   ', '.join(alts))
 else:
diff --git a/Lib/email/_header_value_parser.py 
b/Lib/email/_header_value_parser.py
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -567,14 +567,7 @@ class DisplayName(Phrase):
 
 @property
 def value(self):
-quote = False
-if self.defects:
-quote = True
-else:
-for x in self:
-if x.token_type == 'quoted-string':
-quote = True
-if quote:
+if self.defects or any(x.token_type == 'quoted-string' for x in self):
 pre = post = ''
 if self[0].token_type=='cfws' or self[0][0].token_type=='cfws':
 pre = ' '
diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py
--- a/Lib/idlelib/config.py
+++ b/Lib/idlelib/config.py
@@ -402,7 +402,7 @@ class IdleConf:
 because setting 'name' to a builtin not defined in older IDLEs
 to display multiple error messages or quit.
 See https://bugs.python.org/issue25313.
-When default = True, 'name2' takes precedence over 'name',
+When default is True, 'name2' takes precedence over 'name',
 while older IDLEs will just use name.  When default = False,
 'name2' may still be set, but it is ignored.
 """

--
components: Build
messages: 312040
nosy: dilyan.palauzov
priority: normal
severity: normal
status: open
title: Lib/ be more pythonic
type: performance
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



[issue32808] subprocess.check_output opens an unwanted command line window after fall creator update

2018-02-12 Thread Christian Heigele

Christian Heigele  added the comment:

Please stop investigation on this bug for now, it might be related to an 
in-house security tool.

--

___
Python tracker 

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



[issue30109] make reindent failed.

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

2.7 needs different solution.

The side effect of issue10639 in 2.7 was changing input and output files for 
the reindenter to Unicode files. This was not correct. Standard streams 
stdin/stdout in 2.7 are binary files, and the tokenizer needs the stream of 
bytes.

The proposed PR makes input and output files for the reindenter binary files 
again, and implements detecting line separators for issue10639.

After fixing Tools/scripts/reindent.py running `make reindent` fixed 
Lib/email/utils.py.

--

___
Python tracker 

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



[issue32827] Fix incorrect usage of _PyUnicodeWriter_Prepare()

2018-02-12 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Based on discussion in PR 660.

_PyUnicodeWriter_Prepare() is used incorrectly in 
unicode_decode_call_errorhandler_writer(), _PyUnicode_DecodeUnicodeEscape() and 
PyUnicode_DecodeRawUnicodeEscape() in Objects/unicodeobject.c. The second 
argument is the number of characters that should be reserved after the current 
position. But in these places the total minimal size is passed to 
_PyUnicodeWriter_Prepare(). This can lead to allocating more memory than 
necessary.

--
components: Interpreter Core, Unicode
messages: 312038
nosy: ezio.melotti, serhiy.storchaka, vstinner, xiang.zhang
priority: normal
severity: normal
status: open
title: Fix incorrect usage of _PyUnicodeWriter_Prepare()
type: resource usage
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



[issue32827] Fix incorrect usage of _PyUnicodeWriter_Prepare()

2018-02-12 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue32825] warn user of creation of multiple Tk instances

2018-02-12 Thread mps

New submission from mps :

tkinter is the first GUI interface used by novices. 
They often get in trouble when they create a new Tk instance instead of a 
Toplevel.
It would be helpful to output a warning message in this case (i.e. checking 
_default_root is not None and _support_default_root is True in the Tk 
initialization).
Thank for your attention and best regards.

- mps.

--
components: Tkinter
messages: 312036
nosy: mps
priority: normal
severity: normal
status: open
title: warn user of creation of multiple Tk instances
type: behavior

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Matthias Klose

New submission from Matthias Klose <d...@debian.org>:

seen with the 3.6 branch 20180212, last known succeeding test is the 3.6.4 
release.

test test_idle failed -- Traceback (most recent call last):
  File 
"/home/packages/python/3.6/python3.6-3.6.4/Lib/idlelib/idle_test/test_help_about.py",
 line 78, in test_file_buttons
self.assertEqual(f.readline().strip(), get('1.0', '1.end'))
  File 
"/home/packages/python/3.6/python3.6-3.6.4/build-debug/../Lib/encodings/ascii.py",
 line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1540: 
ordinal not in range(128)

--
assignee: terry.reedy
components: IDLE
messages: 312037
nosy: doko, terry.reedy
priority: normal
severity: normal
status: open
title: idle test fails at least on the 3.6 branch
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32826>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32829] Lib/ be more pythonic

2018-02-12 Thread Christian Heimes

Christian Heimes  added the comment:

We generally don't accept patches on bugs.python.org. Please open a pull 
request on github, see https://devguide.python.org/#contributing

--
nosy: +christian.heimes

___
Python tracker 

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



[issue30109] make reindent failed.

2018-02-12 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +5437
stage: backport needed -> patch review

___
Python tracker 

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



[issue32820] Add bits method to ipaddress

2018-02-12 Thread Christian Heimes

Christian Heimes  added the comment:

I agree with Serhiy and Eric. It's a needless complication of the module. 
What's the actual use case of printing a human readable bit representation of 
an IP address?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue30717] Add unicode grapheme cluster break algorithm

2018-02-12 Thread INADA Naoki

INADA Naoki  added the comment:

We missed 3.7 train.
I'm sorry about I couldn't review it.  But I have many shine features
I want in 3.7 and I have no time to review all.
Especially, I need to understand tr29.  It was hard job to me.

I think publishing this (and any other functions relating to unicode)
to PyPI is better than waiting 3.8.
It make possible to discuss API design with working code, and make it "battle 
tested" before adding it to standard library.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue32828] compress "True if bool(x) else False" expressions

2018-02-12 Thread Дилян Палаузов

New submission from Дилян Палаузов :

diff --git a/Lib/_strptime.py b/Lib/_strptime.py
--- a/Lib/_strptime.py
+++ b/Lib/_strptime.py
@@ -525,7 +525,7 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
 # out the Julian day of the year.
 if julian is None and weekday is not None:
 if week_of_year is not None:
-week_starts_Mon = True if week_of_year_start == 0 else False
+week_starts_Mon = week_of_year_start == 0
 julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,
 week_starts_Mon)
 elif iso_year is not None and iso_week is not None:
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -59,7 +59,7 @@ class Generator:
 """
 
 if mangle_from_ is None:
-mangle_from_ = True if policy is None else policy.mangle_from_
+mangle_from_ = policy is None or policy.mangle_from_
 self._fp = outfp
 self._mangle_from_ = mangle_from_
 self.maxheaderlen = maxheaderlen
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -576,7 +576,7 @@ def rand_aligned_slices(maxdim=5, maxshape=16):
 minshape = 0
 elif n >= 90:
 minshape = 1
-all_random = True if randrange(100) >= 80 else False
+all_random = randrange(100) >= 80
 lshape = [0]*ndim; rshape = [0]*ndim
 lslices = [0]*ndim; rslices = [0]*ndim
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -117,7 +117,7 @@ skip_expected = not os.path.isdir(directory)
 EXTENDEDERRORTEST = False
 
 # Test extra functionality in the C version (-DEXTRA_FUNCTIONALITY).
-EXTRA_FUNCTIONALITY = True if hasattr(C, 'DecClamped') else False
+EXTRA_FUNCTIONALITY = hasattr(C, 'DecClamped')
 requires_extra_functionality = unittest.skipUnless(
   EXTRA_FUNCTIONALITY, "test requires build with -DEXTRA_FUNCTIONALITY")
 skip_if_extra_functionality = unittest.skipIf(
@@ -1455,7 +1455,7 @@ class ArithmeticOperatorsTest(unittest.TestCase):
 for x, y in qnan_pairs + snan_pairs:
 for op in order_ops + equality_ops:
 got = op(x, y)
-expected = True if op is operator.ne else False
+expected = op is operator.ne
 self.assertIs(expected, got,
   "expected {0!r} for operator.{1}({2!r}, {3!r}); "
   "got {4!r}".format(
@@ -1468,7 +1468,7 @@ class ArithmeticOperatorsTest(unittest.TestCase):
 for x, y in qnan_pairs:
 for op in equality_ops:
 got = op(x, y)
-expected = True if op is operator.ne else False
+expected = op is operator.ne
 self.assertIs(expected, got,
   "expected {0!r} for "
   "operator.{1}({2!r}, {3!r}); "
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -20,13 +20,13 @@ except (IndexError, ValueError):
 # tuple of (major, minor)
 WIN_VER = sys.getwindowsversion()[:2]
 # Some tests should only run on 64-bit architectures where WOW64 will be.
-WIN64_MACHINE = True if machine() == "AMD64" else False
+WIN64_MACHINE = machine() == "AMD64"
 
 # Starting with Windows 7 and Windows Server 2008 R2, WOW64 no longer uses
 # registry reflection and formerly reflected keys are shared instead.
 # Windows 7 and Windows Server 2008 R2 are version 6.1. Due to this, some
 # tests are only valid up until 6.1
-HAS_REFLECTION = True if WIN_VER < (6, 1) else False
+HAS_REFLECTION = WIN_VER < (6, 1)
 
 # Use a per-process key to prevent concurrent test runs (buildbot!) from
 # stomping on each other.

--
components: Build
messages: 312039
nosy: dilyan.palauzov
priority: normal
severity: normal
status: open
title: compress "True if bool(x) else False" expressions
type: performance
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



[issue32820] Add bits method to ipaddress

2018-02-12 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +ncoghlan -nick

___
Python tracker 

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



[issue32820] Add bits method to ipaddress

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The usefulness of this feature looks questionable to me.

--
nosy: +nick, serhiy.storchaka

___
Python tracker 

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



[issue32830] tkinter documentation suggests "from tkinter import *", contradicting PEP8

2018-02-12 Thread ChrisRands

New submission from ChrisRands :

Issue arose from this SO post: 
https://stackoverflow.com/questions/48746351/documentation-is-contradicting-pep8

The tkinter documentation suggests:

from tkinter import *

https://docs.python.org/3/library/tkinter.html

But this obviously contradicts PEP8:
"Wildcard imports (from  import *) should be avoided"

https://www.python.org/dev/peps/pep-0008/#imports

Is tkinter a valid exception or is this a documentation bug?

The commit of this line to the documentation is >10 years old (at least Python 
2.4 I think): 
https://github.com/python/cpython/commit/116aa62bf54a39697e25f21d6cf6799f7faa1349#diff-05a258c160de90c51c1948689f788ef7R53

--
assignee: docs@python
components: Documentation
messages: 312045
nosy: ChrisRands, docs@python
priority: normal
severity: normal
status: open
title: tkinter documentation suggests "from tkinter import *", contradicting 
PEP8

___
Python tracker 

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



[issue32832] doctest should support custom ps1/ps2 prompts

2018-02-12 Thread Sergey B Kirpichev

New submission from Sergey B Kirpichev :

The Python stdlib allows override of sys.ps1/ps2 (to make IPython-like dynamic 
prompts and so on).  I believe it would be a good idea to
support this in doctest too, to cover cases when given application
uses different from defaults settings for the interpreter.

Probably, we could add ps1/2 optional arguments for DoctestParser.__init__().

Some projects already patch doctest module for this, e.g. IPython:
https://github.com/ipython/ipython/blob/master/IPython/testing/plugin/ipdoctest.py
It shouldn't be too hard to port this feature.

--
components: Library (Lib)
messages: 312053
nosy: Sergey.Kirpichev
priority: normal
severity: normal
status: open
title: doctest should support custom ps1/ps2 prompts

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

What system?  test_idle passes on Windows.  Unfortunately, none of the *nix or 
Mac buildbots run tkinter and hence no tests that require a live tk window, and 
this one does.  Cheryl, what do you see on your linux?

Byte 0xc3 in position 1540 is the first byte of the utf-8 encoding of the 'ö' 
in Löwis on line 27 of CREDITS.txt.  So on your system, readline must be 
reading *and decoding* more of the file.

I am puzzled that the test fails now if it passed with the 3.6.4 release, as it 
and the textfile have not been touched since last summer.
The files are the same on all 3 python versions.

In any case, I will add encoding='utf-8'to open.  I will also use subtest to 
identify failing cases.  I will need you to verify the fix on your system.

--
nosy: +csabella
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue32820] Add bits method to ipaddress

2018-02-12 Thread Eric Osborne

Eric Osborne  added the comment:

IPv6 is nasty no matter how you do it (cf.
https://tools.ietf.org/html/rfc1924).  And the ipaddr library already has
hex (packed()).

Binary's not about direct readabilty, but about ease of comparison.  It's
much easier to show the reader

'0b0001001000110100'
'0b0001001000110011'
'0b1100'

and have them figure out whether the mask contains both hosts than to show
them

'1.2.3.4'
'1.2.3.3'
'255.255.255.252'
and ask them to convert to binary in their heads.  Without the zero padding
on the left, this is very easy to get wrong.

But I certainly agree that this is somewhat niche and a convenience
function, and if the consensus is that this is too narrow for stdlib, so be
it.

eric

On Mon, Feb 12, 2018 at 8:46 AM Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka  added the comment:
>
> I wouldn't say that
> "0b00011101101110001101101000111000101000101110001101110111001100110100"
> is a very human readable. For more readability it is better to group digits
> by 4 or 8, and why not use hexadecimal then?
>
> In any case the application of this feature looks pretty narrow to me. And
> since it can be implemented as a one-line function, I think it shouldn't be
> added in the stdlib. The ipaddress classes are already complex.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue32830] tkinter documentation suggests "from tkinter import *", contradicting PEP8

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I think tkinter is a valid exception. It provides the enormous number of names 
(mostly constants like RIGHT or VERTICAL) which are convenient to use without 
prefix.

PEP 8 is a style guide for the code of the stdlib. Its suggestions are not 
mandatory for a user code.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32830] tkinter documentation suggests "from tkinter import *", contradicting PEP8

2018-02-12 Thread Ned Deily

Ned Deily  added the comment:

PEP 8 also says: "In particular: do not break backwards compatibility just to 
comply with this PEP!"  This is one of those cases.  There is a ton of code out 
there that depends on importing tkinter this way for the reasons Serhiy cited.  
Thanks for the suggestion but this usage is not going to change.

--
nosy: +ned.deily
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



[issue32818] multiprocessing segmentfault under Windows compatibility mode

2018-02-12 Thread Ma Lin

Ma Lin  added the comment:

segmentfault conditions:
64bit Windows + 32bit Python + Compatibility Mode enabled.

some infomation:
1, 64bit Python doesn't segmentfault.
2, 3.7.0a3 is ok, 3.7.0a4 segmentfaults.
3, unrelated to Windows SDK, switch from 1709 SDK to 1703 SDK also 
segmentfaults.

--

___
Python tracker 

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



[issue32830] tkinter documentation suggests "from tkinter import *", contradicting PEP8

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I want to add that the star import is more convenient when you experiment with 
Tkinter in REPL. You don't know what names will be needed when import Tkinter.

The interpreter core has a special support of Tkinter. You don't need to run 
mainloop() for updating GUI in REPL. So this is a supported case.

--

___
Python tracker 

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



[issue13319] IDLE: Menu accelerator conflict between Format and Options

2018-02-12 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Maybe a solution for this would be to change the name of the 'Format' menu to 
something like 'Source'?  Interestingly, the Format menu is available on 
outwin, even though that is output-only, so I guess 'Source' would only make 
sense if the other uses of an EditorWindow remove it from the menu.

--
nosy: +csabella
versions: +Python 3.8 -Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread Krzysztof Leszczyński

New submission from Krzysztof Leszczyński :

Step to reproduce:

import argparse
ap=argparse.ArgumentParser()
ap.add_argument("--a-b", "--ab")
v1=ap.parse_args(["--ab", "xx"])
print(v1)
# v1==Namespace(a_b='xx')
v2=ap.parse_args(["--a", "xx"])
# v2 should be equal to v1 but instead it raises an error, in spite that --a-b 
and --ab are aliases

--

___
Python tracker 

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



[issue32830] tkinter documentation suggests "from tkinter import *", contradicting PEP8

2018-02-12 Thread ChrisRands

ChrisRands  added the comment:

Ok thanks both for the clarification!

--

___
Python tracker 

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



[issue32828] compress "True if bool(x) else False" expressions

2018-02-12 Thread R. David Murray

R. David Murray  added the comment:

Oops.  I actually didn't intend to close this, but thinking about it I'm going 
to leave it closed.  We generally don't do this kind of "tidy work" unless we 
are touching the code for other reasons.

--

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +5439
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



[issue32831] IDLE: Add docstrings and tests for codecontext

2018-02-12 Thread Cheryl Sabella

Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue32830] tkinter documentation suggests "from tkinter import *", contradicting PEP8

2018-02-12 Thread ChrisRands

ChrisRands  added the comment:

Thanks Serhiy, you might be right (I am not a tkinter user myself).

I also forgot to say that in PEP 328 tkinter is mentioned in this context:
https://www.python.org/dev/peps/pep-0328/#rationale-for-parentheses

--

___
Python tracker 

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



[issue32820] Add bits method to ipaddress

2018-02-12 Thread Eric Osborne via Python-bugs-list

Eric Osborne  added the comment:

It is often useful to have non-decimal representations of IP addresses.
Hex shows up a lot in sniffer traces, which is why I wanted to provide
__index__, but that's not going to happen.  I use binary a lot when
teaching subnet masking and address summarization - if you line up bit
patterns it's much easier to show how things lay out.  It's easy enough to
use bin(int(addr)) but that doesn't zero-pad the string it returns.  I find
myself doing something like

In [23]: a
Out[23]: IPv4Address('1.2.3.4')

In [24]: x = bin(int(a))[2:]

In [25]: full_x = '0b' + ('0' * (32-len(x)) + x)

In [26]: full_x
Out[26]: '0b0001001000110100'

Although, as Eric Smith has pointed out, there's a one liner way to do
this. But if an IP address can represent itself as an integer (IMO the
least useful form) it should have at least a binary representation, and
lack of a seperate __bin__ means this is as close as I could get.

eric

On Mon, Feb 12, 2018 at 7:39 AM Christian Heimes 
wrote:

>
> Christian Heimes  added the comment:
>
> I agree with Serhiy and Eric. It's a needless complication of the module.
> What's the actual use case of printing a human readable bit representation
> of an IP address?
>
> --
> nosy: +christian.heimes
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue32831] IDLE: Add docstrings and tests for codecontext

2018-02-12 Thread Cheryl Sabella

New submission from Cheryl Sabella :

Add docstrings and tests for codecontext.py.

--
assignee: terry.reedy
components: IDLE
messages: 312046
nosy: csabella, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Add docstrings and tests for codecontext
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



[issue32820] Add bits method to ipaddress

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I wouldn't say that 
"0b00011101101110001101101000111000101000101110001101110111001100110100"
 is a very human readable. For more readability it is better to group digits by 
4 or 8, and why not use hexadecimal then?

In any case the application of this feature looks pretty narrow to me. And 
since it can be implemented as a one-line function, I think it shouldn't be 
added in the stdlib. The ipaddress classes are already complex.

--

___
Python tracker 

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



[issue32828] compress "True if bool(x) else False" expressions

2018-02-12 Thread R. David Murray

R. David Murray  added the comment:

The one in generator.py should not be changed, it is clearer as written.  I 
don't have a strong opinion on the others.

--
nosy: +r.david.murray
resolution:  -> rejected
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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The failure is reproduced on Posix locale. Files are open with bare open() 
which uses the locale encoding by default. Which is ASCII in this case.

--
components: +Tests
keywords: +easy
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread Krzysztof Leszczyński

Change by Krzysztof Leszczyński :


--
components: Library (Lib)
nosy: Krzysztof Leszczyński
priority: normal
severity: normal
status: open
title: argparse doesn't recognise two option aliases as equal
type: behavior
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



[issue32221] Converting ipv6 address to string representation using getnameinfo() is wrong.

2018-02-12 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 7766b96ab80b04509bbac708ee5ecf3c1c5934fc by Yury Selivanov 
(Коренберг Марк) in branch 'master':
bpo-32221: makeipaddr(): remove interface part + speedup (GH-5449) (#5449)
https://github.com/python/cpython/commit/7766b96ab80b04509bbac708ee5ecf3c1c5934fc


--

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I reproduced the exact failure by temporarily replacing 'utf-8' with 'ascii' in 
my clone.  So I don't need anyone else to verify the fix.

--

___
Python tracker 

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



[issue32642] add support for path-like objects in sys.path

2018-02-12 Thread Jay Yin

Jay Yin  added the comment:

ok, so I found the PathFinder class you referenced, just making sure, this 
issue pertains to changing "self.path"'s usage and declaration to be a 
path-like object instead of the hard coded 'sys', 'path' returns? or is that 
part of it already?, also since this uses a tuple to keep track of the parent 
path, is there functionality in the path-like objects to find parent paths?

--

___
Python tracker 

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



[issue32221] Converting ipv6 address to string representation using getnameinfo() is wrong.

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5441

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5443

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5442
stage: commit review -> patch review

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset f34e03ec0ea6a4cef8d966087c77e616c4a5893b by Terry Jan Reedy in 
branch 'master':
bpo-32826: Add "encoding=utf-8" to open() in idle_test/test_help_about. 
(GH-5639)
https://github.com/python/cpython/commit/f34e03ec0ea6a4cef8d966087c77e616c4a5893b


--

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I just discovered that the default for me is some version of latin1, not ascii, 
so that utf-8 'ö' is read as 'ö'.  Hence, no UnicodeDecodeError even if 'ö' is 
being read and decoded by the initial readline call.  I presume the same is 
true on current Windows buildbots.  Hence, it was a bug to not include an 
encoding in the test file open calls.  (The widget itself *does* use explicit 
'ascii' or 'utf-8' encodings for open().)

--
components:  -Tests
stage: patch review -> commit review

___
Python tracker 

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



[issue32834] test_gdb fails with Posix locale in 3.7

2018-02-12 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

$ LC_ALL=C ./python -We -m test -vuall -m test_strings test_gdb
...
==
FAIL: test_strings (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of unicode strings
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpython3.7/Lib/test/test_gdb.py", line 331, in 
test_strings
check_repr('\u2620')
  File "/home/serhiy/py/cpython3.7/Lib/test/test_gdb.py", line 323, in 
check_repr
self.assertGdbRepr(text)
  File "/home/serhiy/py/cpython3.7/Lib/test/test_gdb.py", line 271, in 
assertGdbRepr
% (gdb_repr, exp_repr, gdb_output)))
AssertionError: "'\\u2620'" != "'☠'"
- '\u2620'
+ '☠'
 : "'\\u2620'" did not equal expected "'☠'"; full output was:
Breakpoint 1 at 0x11a4df: file Python/bltinmodule.c, line 1215.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, builtin_id (self=self@entry=, v='\u2620') at 
Python/bltinmodule.c:1215
1215{
#0  builtin_id (self=, v='\u2620') at Python/bltinmodule.c:1215


--

This looks be related to PEP 538.

--
messages: 312069
nosy: ncoghlan, serhiy.storchaka
priority: normal
severity: normal
status: open
title: test_gdb fails with Posix locale in 3.7
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue32642] add support for path-like objects in sys.path

2018-02-12 Thread Jay Yin

Jay Yin  added the comment:

https://github.com/python/cpython/blob/3c34aad4e7a95913ec7db8e5e948a8fc69047bf7/Lib/importlib/_bootstrap_external.py#L1069-L1090

those are the particular class and lines I'm referring to

--

___
Python tracker 

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



[issue29248] os.readlink fails on Windows

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5440

___
Python tracker 

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



[issue29248] os.readlink fails on Windows

2018-02-12 Thread Berker Peksag

Change by Berker Peksag :


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



[issue29248] os.readlink fails on Windows

2018-02-12 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 3c34aad4e7a95913ec7db8e5e948a8fc69047bf7 by Berker Peksag (SSE4) 
in branch 'master':
bpo-29248: Fix os.readlink() on Windows (GH-5577)
https://github.com/python/cpython/commit/3c34aad4e7a95913ec7db8e5e948a8fc69047bf7


--

___
Python tracker 

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



[issue30109] make reindent failed.

2018-02-12 Thread Serhiy Storchaka

Change 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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

I've been able to run the IDLE test suite on Linux.

As far as this issue, there's also a readline in test_textview that you may 
want to add the encoding to, even though it's only reading __file__.

--

___
Python tracker 

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



[issue29248] os.readlink fails on Windows

2018-02-12 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset a1d33f742515dc70ae99bc3ea1c851729522afc3 by Berker Peksag (Miss 
Islington (bot)) in branch '3.6':
bpo-29248: Fix os.readlink() on Windows (GH-5577)
https://github.com/python/cpython/commit/a1d33f742515dc70ae99bc3ea1c851729522afc3


--

___
Python tracker 

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



[issue30109] make reindent failed.

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 17cec70a38b297779b8fd3f081fb041d45ae1dff by Serhiy Storchaka in 
branch '2.7':
bpo-30109: Fix reindent.py for non-ASCII files. (#5637)
https://github.com/python/cpython/commit/17cec70a38b297779b8fd3f081fb041d45ae1dff


--

___
Python tracker 

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



[issue32731] getpass.getuser() raises an unspecified exceptions (ImportError, OSError, etc)

2018-02-12 Thread Fangyi Zhou

Fangyi Zhou  added the comment:

Hi. I've updated the docs.

I'm wondering if the code needs to be patched as well. Essentially we should 
raise a unified Exception for unable to get the username I suppose?

Please let me know if you have any comments/suggestions on wording. Thanks.

--
nosy: +fangyizhou

___
Python tracker 

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



[issue29248] os.readlink fails on Windows

2018-02-12 Thread miss-islington

miss-islington  added the comment:


New changeset 74ebbaeb566dc10031756430ec5c896e56d0e491 by Miss Islington (bot) 
in branch '3.7':
bpo-29248: Fix os.readlink() on Windows (GH-5577)
https://github.com/python/cpython/commit/74ebbaeb566dc10031756430ec5c896e56d0e491


--
nosy: +miss-islington

___
Python tracker 

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



[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread paul j3

Change by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

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



[issue32837] IDLE: require encoding argument for textview.view_file

2018-02-12 Thread Terry J. Reedy

New submission from Terry J. Reedy :

Built-in open has an encoding parameter whose default value depends on the 
system: 'ascii' for some POSIX locales; 'latin1' or similar for most Windows 
sold in the USA or western Europe; and ???.  In idlelib.textview, the signature 
for view_file currently includes 'encoding=None'.  There have been 2 issues, 
#32826 and another, about tests using the default failing because of 'Löwis' on 
line 27 of CREDITS.txt.  It therefore seems an error for a global 
cross-platform application to use the default encoding.

To prevent this, we should remove '=None' from the encoding part of the 
view_file definition and make view_file calls explicitly pass an encoding.  For 
IDLE itself, this will be 'ascii' or 'utf-8'.

This expands upon a note by Cheryl Sabella in #32826 about one of the three 
calls that fail with the change until fixed.

I will not default to 'utf-8' because 'ascii' catches erroneous non-ascii 
characters in ascii-only files.  For instance, a draft of README.txt was 
prepared with an editor that replaced ascii " and " with left and right quotes. 
 I will not restricting the encoding otherwise because there might be external 
uses of the file that use other encodings.

PR to follow as soon as I get bpo number.

--
assignee: terry.reedy
components: IDLE
messages: 312085
nosy: terry.reedy
priority: normal
severity: normal
stage: commit review
status: open
title: IDLE: require encoding argument for textview.view_file
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



[issue32837] IDLE: require encoding argument for textview.view_file

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5449

___
Python tracker 

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



[issue32837] IDLE: require encoding argument for textview.view_file

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5448

___
Python tracker 

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



[issue29248] os.readlink fails on Windows

2018-02-12 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you, Craig and SSE4.

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



[issue32837] IDLE: require encoding argument for textview.view_file

2018-02-12 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +5447
stage: commit review -> patch review

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Serhiy, thanks for comment and review.
Cheryl, #32837 expands upon your comment.

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



[issue32837] IDLE: require encoding argument for textview.view_file

2018-02-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset 688722cedd6437910ff185ecf94fb3b749ad37f2 by Terry Jan Reedy in 
branch 'master':
bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646)
https://github.com/python/cpython/commit/688722cedd6437910ff185ecf94fb3b749ad37f2


--

___
Python tracker 

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



[issue32837] IDLE: require encoding argument for textview.view_file

2018-02-12 Thread miss-islington

miss-islington  added the comment:


New changeset 65c32bbe85862ab5eb52a0d4340e844e13d0f7ee by Miss Islington (bot) 
in branch '3.7':
bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646)
https://github.com/python/cpython/commit/65c32bbe85862ab5eb52a0d4340e844e13d0f7ee


--
nosy: +miss-islington

___
Python tracker 

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



[issue24665] CJK support for textwrap

2018-02-12 Thread Julien Palard

Julien Palard  added the comment:

I reread issue6755, issue12485, issue12499, and issue12568 about the 
textwrap/char width topic, and went to those conclusions:

- It's a hard topic [1][2], so we may not succeed in a single shot.
- The work is already done by wcwidth in the libc, which does not exists on 
windows and may not exist on MacOS.
- The work is already partially done for CJK in the Unicode standard.

So I'm OK with adding CJK support to textwrap *as a first step*, which means 
I'm *not* ok with the CJK parameter to the wrap function, as maybe in the 
future we'll do more.

I'm also not OK with this being not the default, as many code using textwrap do 
not know in advance if they need CJK, they should not care, it should be done 
right by default.

But having CJK support by default also mean we'll have to fallback silently to 
a non-unicode textwrap if unicodedata is not available, as Victor said in PR-89 
"Python requires optparse to compile modules like unicodedata, optparse imports 
textwrap which now always requires unicodedata", which may or may not lead to 
surprising behavior.

[1] The unicode standard is not clear about character width (not its role, font 
dependent), only where it's OK to put the line break.
[2] CJK is not enough, there's plenty of other characters of width not equal to 
one, like combining characters, tabulations, non-printables, 
Prepended_Concatenation_Mark having a typical width of zero but sometimes 1, 
U+00AD being tricky, Hangul Jamo medial vowels and final consonants are 
"conjoining", and so on... this need a huge effort / attention, this if we're 
going down this hole it means a lot of maintenance / new issues about this or 
that character being reported with the "wrong" size.

--
nosy: +mdk

___
Python tracker 

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



[issue29248] os.readlink fails on Windows

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5445

___
Python tracker 

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



[issue32835] Add documention mentioning that Cygwin isn't fully compatible

2018-02-12 Thread Jay Yin

Jay Yin  added the comment:

ah I see, hence the *currently* incompatible, there must be some way of 
tracking areas in need of help without having to use the search, kind of like 
the way Github uses labels.

--
type: enhancement -> 

___
Python tracker 

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



[issue32835] Add documention mentioning that Cygwin isn't fully compatible

2018-02-12 Thread Jay Yin

New submission from Jay Yin :

I didn't find any documentation stating that Cygwin isn't currently compatible 
with building, I was wondering if it would be good to add documentation stating 
this and that it would be an area requiring help.

--
assignee: docs@python
components: Documentation
messages: 312080
nosy: docs@python, jayyin11043
priority: normal
severity: normal
status: open
title: Add documention mentioning that Cygwin isn't fully compatible
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue32835] Add documention mentioning that Cygwin isn't fully compatible

2018-02-12 Thread R. David Murray

R. David Murray  added the comment:

We don't (can't) document everything we're *not* compatible with, we can only 
realisticly document what we support.  I thought we did that, but all I can 
find at the moment is PEP 11, which you are correct, does not list cygwin as a 
no-longer-supported platform (although we'd like to support it, see the many 
issues in this tracker about it).

--
nosy: +r.david.murray

___
Python tracker 

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



[issue32779] urljoining an empty query string doesn't clear query string

2018-02-12 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue32756] argparse: parse_known_args: raising exception on unknown arg following known one

2018-02-12 Thread paul j3

Change by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

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



[issue32221] Converting ipv6 address to string representation using getnameinfo() is wrong.

2018-02-12 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 0442599961f966a3dc7f3fe6a3c0d5765fcf2082 by Yury Selivanov (Miss 
Islington (bot)) in branch '3.7':
bpo-32221: makeipaddr(): remove interface part + speedup (GH-5449) (GH-5449) 
(#5641)
https://github.com/python/cpython/commit/0442599961f966a3dc7f3fe6a3c0d5765fcf2082


--

___
Python tracker 

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



[issue32221] Converting ipv6 address to string representation using getnameinfo() is wrong.

2018-02-12 Thread Yury Selivanov

Change by Yury Selivanov :


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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread miss-islington

miss-islington  added the comment:


New changeset 46daf39453023767eef3b6876d4a34996e124397 by Miss Islington (bot) 
in branch '3.6':
bpo-32826: Add "encoding=utf-8" to open() in idle_test/test_help_about. 
(GH-5639)
https://github.com/python/cpython/commit/46daf39453023767eef3b6876d4a34996e124397


--

___
Python tracker 

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



[issue32826] idle test fails at least on the 3.6 branch

2018-02-12 Thread miss-islington

miss-islington  added the comment:


New changeset 38b4dd7f83fbdce6fe970088cd89b80f074a13f6 by Miss Islington (bot) 
in branch '3.7':
bpo-32826: Add "encoding=utf-8" to open() in idle_test/test_help_about. 
(GH-5639)
https://github.com/python/cpython/commit/38b4dd7f83fbdce6fe970088cd89b80f074a13f6


--
nosy: +miss-islington

___
Python tracker 

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



[issue32835] Add documention mentioning that Cygwin isn't fully compatible

2018-02-12 Thread Christian Heimes

Change by Christian Heimes :


--
keywords: +easy
stage:  -> needs patch
type:  -> enhancement
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue32836] Symbol table for comprehensions (list, dict, set) still includes temporary _[1] variable

2018-02-12 Thread Martijn Pieters

New submission from Martijn Pieters :

In Python 2.6, a list comprehension was implemented in the current scope using 
a temporary _[1] variable to hold the list object:

>>> import dis
>>> dis.dis(compile('[x for x in y]', '?', 'exec'))
  1   0 BUILD_LIST   0
  3 DUP_TOP
  4 STORE_NAME   0 (_[1])
  7 LOAD_NAME1 (y)
 10 GET_ITER
>>   11 FOR_ITER13 (to 27)
 14 STORE_NAME   2 (x)
 17 LOAD_NAME0 (_[1])
 20 LOAD_NAME2 (x)
 23 LIST_APPEND
 24 JUMP_ABSOLUTE   11
>>   27 DELETE_NAME  0 (_[1])
 30 POP_TOP
 31 LOAD_CONST   0 (None)
 34 RETURN_VALUE

Nick Cochlan moved comprehensions into a separate scope in #1660500, and 
removed the need for a temporary variable in the process (the list / dict / set 
lives only on the stack).

However, the symbol table generates the _[1] name:

>>> import symtable
>>> symtable.symtable('[x for x in y]', '?', 
>>> 'exec').get_children()[0].get_symbols()
[, , ]

Can this be dropped? I think all temporary variable handling can be ripped out.

--
messages: 312081
nosy: mjpieters
priority: normal
severity: normal
status: open
title: Symbol table for comprehensions (list, dict, set) still includes 
temporary _[1] variable

___
Python tracker 

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



[issue32798] mmap.flush() on Linux does not accept the "offset" and "size" args

2018-02-12 Thread Xiang Zhang

Xiang Zhang  added the comment:

One thing to note is the behaviour seems fit implementation detail. POSIX 
doesn't requires this for both mmap and msync, it's optional:

The mmap( ) function may fail if:
[EINVAL] The addr argument (if MAP_FIXED was specified) or off is not a 
multiple of the page size as returned

The msync( ) function may fail if:
[EINVAL] The value of addr is not a multiple of the page size as returned by 
sysconf( ).

--
nosy: +berker.peksag, pablogsal, xiang.zhang

___
Python tracker 

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



[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread paul j3

paul j3  added the comment:

When I run your setup in ipython, I see a display of the newly added Action:

   Out[2]: _StoreAction(option_strings=['--a-b', '--ab'], dest='a_b', 
   nargs=None, const=None, default=None, type=None, choices=None, help=None, 
   metavar=None)

Note the 'option_strings' list.

This strings are also entered as keys in a parser dictionary:

In [6]: list(ap._option_string_actions.keys())
Out[6]: ['--a-b', '--help', '--ab', '-h']

The values are the corresponding Actions, in this case the default 'help' one, 
and the newly added 'StoreAction'.  So the parser can only tell if two keys are 
'aliases' by checking for matching values.

The abbreviation ambiguity error is raised in 'parser._parse_optional'.  If 
'ap.allow_abbrev' is does

ap._get_option_tuples('--a')

and raises the error if this returns more than one Action.  It does not check 
whether the multiple actions has the same ID.  I suppose it could, but it 
doesn't.

The option string is passed to the Action.__call__:

def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, values)

None of the defined Action subclasses makes use of the this 'option_string' 
parameter (that I recall).  But I can easily imagine writing a custom Action 
class that does make use of this parameter.  

Are aliases like this needed?  Seems they just clutter the help:

usage: ipython3 [-h] [--a-b A_B]

optional arguments:
-h, --help   show this help message and exit
--a-b A_B, --ab A_B

The clutter will be more obvious with longer realistic flags.

Here the aliases end up disabling the '--a' abbreviation.  '--a-' still works.

--

___
Python tracker 

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



[issue20632] Define a new __key__ protocol

2018-02-12 Thread Josh Rosenberg

Josh Rosenberg  added the comment:

Do data classes let you define some fields as being excluded from the 
equality/ordering/hashing? I got the impression that if a field existed, it was 
part of the "key" no matter what, which isn't necessarily correct in the 
general case. Simple examples would be attributes that equivalent C++ would tag 
with the mutable keyword; they're not part of the logical state of the instance 
(e.g. debugging counters or whatever), so they shouldn't be included in the 
"key".

--

___
Python tracker 

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



[issue20632] Define a new __key__ protocol

2018-02-12 Thread Josh Rosenberg

Josh Rosenberg  added the comment:

Ah, never mind. Looks like dataclasses.InitVar fields seem to be the answer to 
excluding a field from the auto-generated methods.

--

___
Python tracker 

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



[issue32837] IDLE: require encoding argument for textview.view_file

2018-02-12 Thread miss-islington

miss-islington  added the comment:


New changeset 9fad857444d90b9c6c36c31f5f07e57f390a70f2 by Miss Islington (bot) 
in branch '3.6':
bpo-32837: IDLE - require encoding argument for textview.view_file. (GH-5646)
https://github.com/python/cpython/commit/9fad857444d90b9c6c36c31f5f07e57f390a70f2


--

___
Python tracker 

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



[issue24665] CJK support for textwrap

2018-02-12 Thread Julien Palard

Change by Julien Palard :


--
pull_requests: +5450, 5451
stage:  -> patch review

___
Python tracker 

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



[issue24665] CJK support for textwrap

2018-02-12 Thread Julien Palard

Change by Julien Palard :


--
pull_requests: +5450
stage:  -> patch review

___
Python tracker 

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



[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread Josh Rosenberg

Josh Rosenberg  added the comment:

To be clear, the specific error is:

error: ambiguous option: --a could match --a-b, --ab

which makes sense if they're separate switches, but doesn't make sense when 
both expansions are aliases of one another.

--
nosy: +josh.r

___
Python tracker 

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



[issue20928] xml.etree.ElementInclude does not include nested xincludes

2018-02-12 Thread ruffsl

ruffsl  added the comment:

I see it's been a few years, but I would still like to see 
xml.etree.ElementInclude support nested xincludes, as lxml does. Additionally, 
I'd like to have the default_loader attempt to open the href with respect to 
the original xml file's dirname, as again with lxml, as opposed to just 
assuming its relative to the working directory for the session.

Let me know if there are any changes you'd like to see in the latest patch 
here, and I could incorporate those into a new PR?

--
nosy: +ruffsl

___
Python tracker 

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



[issue32820] Add bits method to ipaddress

2018-02-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

I think the aspect that makes this potentially worthy of a helper function is 
the need to dynamically adjust the field width based on whether you're printing 
an IPv4 address or an IPv6 one, whether you're printing it in binary or 
hexadecimal, whether you're printing separator characters, and whether you're 
printing the base indicator prefix.

For example, consider the following:

```
>>> ip4 = ipaddress.ip_address("1.2.3.4")
>>> ip4
IPv4Address('1.2.3.4')
>>> ip6 = ipaddress.ip_address("::1:2:3:4")
>>> ip6
IPv6Address('::1:2:3:4')
>>> format(int(ip4), "#041_b")
'0b_0001__0010__0011__0100'
>>> format(int(ip6), "#041_x")
'0x____0001_0002_0003_0004'
```

The "41" in those examples comes from "prefix_len + (num_bits / bits_per_char) 
+ (num_bits / bits_per_char / chars_per_separator) - 1":

IPv4 in binary: 2 + (32 / 1) + (32 / 1 / 4) - 1 = 2 + 32 + 8 - 1 = 41
IPv6 in hex: 2 + (128 / 4) + (128 / 1 / 4) - 1 = 2 + 32 + 8 - 1 = 41

So I think the potentially interesting method to implement here would be 
*__format__*, such that the field width calculation could be made implicit 
based on the other options selected.

While backwards compatibility means that IP address formatting would still need 
to be equivalent to "str(ip)" by default, it would be reasonably 
straightforward to make "format(ip, 'b')" output the number in binary, 
"format(ip, 'x')" do it in hex, and "format(ip, 'n')" be equivalent to "b" for 
IPv4 addresses, and "x" for IPv6 ones.

Unlike ordinary numbers, the IP addresses would always be zero-padded to a 
fixed width (32-bits for IPv4, 128 bits for IPv6), but "#" and "_" would be 
accepted to indicate whether or to add the base indicator prefix and/or group 
separators.

Given those enhancements, the display examples above would become:

```
>>> format(ip4, "#_n")
'0b_0001__0010__0011__0100'
>>> format(ip6, "#_n")
'0x____0001_0002_0003_0004'
```

--

___
Python tracker 

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



[issue32827] Fix incorrect usage of _PyUnicodeWriter_Prepare()

2018-02-12 Thread Xiang Zhang

Xiang Zhang  added the comment:

Nice. The only question I have is this is a bugfix or enhancement? Current code 
seems won't cause any problem but just allocates more memory than needed.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue32834] test_gdb fails with Posix locale in 3.7

2018-02-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

I can reproduce this, but it looks to me like it's being triggered by UTF-8 
mode rather than locale coercion (the "LC_ALL=C" setting will implicitly 
disable locale coercion entirely):

```
$ LANG=C PYTHONCOERCECLOCALE=warn ./python -We -m test -uall -m test_strings 
test_gdb
Python detected LC_CTYPE=C: LC_CTYPE coerced to C.UTF-8 (set another locale or 
PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior).
Run tests sequentially
0:00:00 load avg: 0.34 [1/1] test_gdb
1 test OK.

Total duration: 2 sec
Tests result: SUCCESS

$ LC_ALL=C PYTHONUTF8=0 ./python -We -m test -uall -m test_strings test_gdb
Run tests sequentially
0:00:00 load avg: 0.17 [1/1] test_gdb
1 test OK.

Total duration: 2 sec
Tests result: SUCCESS
```

I expect the fix will be to adjust test_gdb's expectations in this case,  as 
there's going to be a genuine difference between gdb's locale dependent 
behaviour and Python's UTF-8 mode behaviour.

--
nosy: +vstinner

___
Python tracker 

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



[issue20632] Define a new __key__ protocol

2018-02-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

For now, I'm going to close this as "out of date", with the guidance being 
"Define a data class instead" (since that gets rid of the historical 
boilerplate a different way: auto-generating suitable methods based on the 
field declarations).

If somebody comes up with a use case for this protocol idea that isn't 
adequately covered by data classes, then they can bring it up on python-ideas, 
and we can look at revisiting the question.

--
resolution:  -> out of date
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



[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread paul j3

paul j3  added the comment:

Subparsers have aliases, argument option strings don't, at least not formally.  
Once an argument is added, its flags are entered in several lists.  One list 
belongs to the Action itself, another belongs to the parser (it might actually 
be a dictionary).  The code could check that '--a-b' and '--ab' belong to the 
same Action, but I suspect it doesn't, at least not at the point where it is 
checking for ambiguity.

We can look at the code to verify this.  It is also entirely likely that this 
issue has already been raised.  There are other issues regarding how it checks 
for abbreviations (and how to disable abbreviations).

--

___
Python tracker 

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



[issue32758] Stack overflow when parse long expression to AST

2018-02-12 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation -Interpreter Core
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



[issue32720] Format mini-language integer definition is incorrect

2018-02-12 Thread miss-islington

miss-islington  added the comment:


New changeset 6708be744d032aeffab3e2cf0b064a41a719d8a1 by Miss Islington (bot) 
in branch '3.6':
bpo-32720: Fixed the replacement field grammar documentation. (GH-5544) 
(GH-5547)
https://github.com/python/cpython/commit/6708be744d032aeffab3e2cf0b064a41a719d8a1


--
nosy: +miss-islington

___
Python tracker 

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



[issue32720] Format mini-language integer definition is incorrect

2018-02-12 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

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



[issue30579] Allow traceback objects to be instantiated/mutated/annotated

2018-02-12 Thread Nick Coghlan

Change by Nick Coghlan :


--
pull_requests: +5455

___
Python tracker 

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



[issue32827] Fix incorrect usage of _PyUnicodeWriter_Prepare()

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 09819ef05a9a1b13321b56c09f48ca45b46e8656 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.7':
bpo-32827: Fix usage of _PyUnicodeWriter_Prepare() in decoding errors handler. 
(GH-5636) (GH-5650)
https://github.com/python/cpython/commit/09819ef05a9a1b13321b56c09f48ca45b46e8656


--

___
Python tracker 

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



[issue32827] Fix incorrect usage of _PyUnicodeWriter_Prepare()

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5452
stage: commit review -> patch review

___
Python tracker 

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



[issue32827] Fix incorrect usage of _PyUnicodeWriter_Prepare()

2018-02-12 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5453

___
Python tracker 

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



[issue32827] Fix incorrect usage of _PyUnicodeWriter_Prepare()

2018-02-12 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset b7e2d67f7c035f09c921ca4e7a36529cd502ccf7 by Serhiy Storchaka in 
branch 'master':
bpo-32827: Fix usage of _PyUnicodeWriter_Prepare() in decoding errors handler. 
(GH-5636)
https://github.com/python/cpython/commit/b7e2d67f7c035f09c921ca4e7a36529cd502ccf7


--

___
Python tracker 

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



[issue32837] IDLE: require encoding argument for textview.view_file

2018-02-12 Thread Terry J. Reedy

Change by Terry J. Reedy :


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



[issue32370] Wrong ANSI encoding used by subprocess for some locales

2018-02-12 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +5456

___
Python tracker 

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



  1   2   >