[issue39227] OverflowError in len(range(2**63))

2020-01-05 Thread Mark Dickinson


Mark Dickinson  added the comment:

(See also #21444)

--

___
Python tracker 

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



[issue39227] OverflowError in len(range(2**63))

2020-01-05 Thread Mark Dickinson


Mark Dickinson  added the comment:

Duplicate of #12159?

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2020-01-05 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +17278
pull_request: https://github.com/python/cpython/pull/17858

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2020-01-05 Thread Inada Naoki


Inada Naoki  added the comment:

There is a document about it in Doc/library/site.rst already.

I'm not sure this should be documented in the tutorial.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue38597] C Extension import limit

2020-01-05 Thread Stefan Behnel


Stefan Behnel  added the comment:

Cython doesn't interfere with the C compiler setup in any way, that's left
to distutils/setuptools (and the user).

--

___
Python tracker 

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



[issue39229] library/functions.rst causes translated builds to fail

2020-01-05 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +mdk

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2020-01-05 Thread Vinay Keerthi


Vinay Keerthi  added the comment:

Just chiming in my opinion, the site-packages directory is also dependent on 
venv, correct? So would explaining where it is at a global install level be 
much use? Or do you mean explaining where site-packages is even for a venv?


I could take this up, if some agrees that jr needs doing.

--
nosy: +stonecharioteer

___
Python tracker 

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



[issue39229] library/functions.rst causes translated builds to fail

2020-01-05 Thread Rafael Fontenelle


Change by Rafael Fontenelle :


--
keywords: +patch
pull_requests: +17277
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17857

___
Python tracker 

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



[issue39229] library/functions.rst causes translated builds to fail

2020-01-05 Thread Rafael Fontenelle


New submission from Rafael Fontenelle :

Documentation file library/functions.rst has a syntax issue that when building 
documentation with warnings as errors, the following message appears:

cpython/Doc/library/functions.rst:: WARNING: inconsistent term references in 
translated message. original: [], translated: [':ref:`evento de auditoria 
`']

After several testing, it seems that what is causing this is 
librar/functions.rst's line 795 not having a reference ":ref:`auditing event 
`".


Steps to reproduce the issue:

1. git clone --depth 1 https://github.com/python/cpython

2. mkdir -p locale/pt_BR/LC_MESSAGES
3. git clone --depth 1 https://github.com/python/python-docs-pt-br 
locale/pt_BR/LC_MESSAGES

4. cd locale/pt_BR/LC_MESSAGES

# This takes about 40 minutes (can be ignored for outdated po files with more 
unrelated syntax errors) 
5. tx pull --force --language pt_BR --parallel

6. cd ../../..

7. cd cpython/Doc/

8. make venv

9. make html\
SPHINXOPTS='-q --keep-going -jauto  \
-D locale_dirs=../../locale \
-D language=pt_BR   \
-D gettext_compact=0\
-D latex_engine=xelatex \
-D latex_elements.inputenc= \
-D latex_elements.fontenc='

10. Look for library/functions.rst "WARNING" error message between the output.

--
assignee: docs@python
components: Documentation
messages: 359401
nosy: docs@python, rffontenelle
priority: normal
severity: normal
status: open
title: library/functions.rst causes translated builds to fail
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2020-01-05 Thread daniel hahler


Change by daniel hahler :


--
keywords: +patch
pull_requests: +17276
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17855

___
Python tracker 

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



[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2020-01-05 Thread daniel hahler

New submission from daniel hahler :

Exceptions within `__repr__` methods of captured locals
(e.g. via the `capture_locals` argument of `TracebackException`) are not 
handled:

```
import traceback


class CrashingRepr:
def __repr__(self):
raise RuntimeError("crash")


traceback.FrameSummary("fname", 1, "name", locals={"crash": CrashingRepr()})
```

Result:
```
Traceback (most recent call last):
  File "test_framesummary_repr.py", line 9, in 
traceback.FrameSummary("fname", 1, "name", locals={"crash": CrashingRepr()})
  File "…/pyenv/3.8.0/lib/python3.8/traceback.py", line 260, in __init__
self.locals = {k: repr(v) for k, v in locals.items()} if locals else None
  File "…/pyenv/3.8.0/lib/python3.8/traceback.py", line 260, in 
self.locals = {k: repr(v) for k, v in locals.items()} if locals else None
  File "test_framesummary_repr.py", line 6, in __repr__
raise RuntimeError("crash")
RuntimeError: crash
```

The following patch would fix this:

```diff
diff --git i/Lib/traceback.py w/Lib/traceback.py
index 7a4c8e19f9..eed7082db4 100644
--- i/Lib/traceback.py
+++ w/Lib/traceback.py
 class FrameSummary:
 """A single frame from a traceback.

@@ -257,7 +265,17 @@ def __init__(self, filename, lineno, name, *, 
lookup_line=True,
 self._line = line
 if lookup_line:
 self.line
-self.locals = {k: repr(v) for k, v in locals.items()} if locals else 
None
+if locals:
+self.locals = {}
+for k, v in locals.items():
+try:
+self.locals[k] = repr(v)
+except (KeyboardInterrupt, SystemExit):
+raise
+except BaseException as exc:
+self.locals[k] = f""
+else:
+self.locals = None

 def __eq__(self, other):
 if isinstance(other, FrameSummary):

```

--
components: Library (Lib)
messages: 359400
nosy: blueyed
priority: normal
severity: normal
status: open
title: traceback.FrameSummary does not handle exceptions from `repr()`
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38907] http.server (command) fails to bind dual-stack on Windows

2020-01-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17275
pull_request: https://github.com/python/cpython/pull/17854

___
Python tracker 

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



[issue38907] http.server (command) fails to bind dual-stack on Windows

2020-01-05 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset ee94bdb0598f9bc47d6a49e58fffc97aa617be96 by Jason R. Coombs in 
branch 'master':
bpo-38907: In http.server script, restore binding to IPv4 on Windows. (GH-17851)
https://github.com/python/cpython/commit/ee94bdb0598f9bc47d6a49e58fffc97aa617be96


--

___
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

2020-01-05 Thread Manish


Manish  added the comment:

Oh, also, if y'all are fine with binding to Rust (through a C ABI) I'd love to 
help y'all use unicode-segmentation, which is much less work that pulling in 
ICU. Otherwise if y'all have implementation questions I can answer them. This 
spec is kinda tricky to implement efficiently, but it's not super hard.

--

___
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

2020-01-05 Thread Manish

Manish  added the comment:

Hi,

Unicodey person here, I'm involved in Unicode itself and also maintain an 
implementation of this particular spec[1].


So, firstly,

> "a⃑".center(width=5, fillchar=".")

If you're trying to do terminal width stuff, extended grapheme clusters *will 
not* solve the problem for you. There is no algorithm specified in Unicode that 
does this, because this is font dependent. Extended grapheme clusters are 
better than code points for this, however, and will not ever produce *worse* 
results.


It's fine to expose this, but it's worth adding caveats.

Also, yes, please do not expose a direct indexing function. Aside from almost 
all Unicode algorithms being streaming algorithms and thus inefficient to index 
directly, needing to directly index a grapheme cluster is almost always a sign 
that you are making a mistake.

> Yes. I clearly don't want this PR to be interpreted as "we're needing ICU". 
> ICU provides much much more than what I'm willing to provide. My goal here is 
> just to "fix" how the python's standard library iterates over characters. 
> Noting more, nothing less.

I think it would be a mistake to make the stdlib use this for most notions of 
what a "character" is, as I said this notion is also inaccurate. Having an 
iterator library somewhere that you can use and compose is great, changing the 
internal workings of string operations would be a major change, and not 
entirely productive.

There's only one language I can think of that uses extended grapheme clusters 
as its default notion of "character": Swift. Swift is largely designed for UI 
stuff, and it makes sense in this context. This is also baked in very deeply to 
the language (e.g. their Character class is a thin wrapper around String, since 
grapheme clusters can be arbitrarily large). You'd need a pretty major paradigm 
shift for python to make a similar change, and it doesn't make as much sense 
for python in the first place.

Starting off with a library published to pypi makes sense to me.


 [1]: https://github.com/unicode-rs/unicode-segmentation/

--
nosy: +Manishearth

___
Python tracker 

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



[issue39211] Change in http.server default IP behavior?

2020-01-05 Thread Shane


Shane  added the comment:

Based on my understanding, your fix should do it.

--
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue38597] C Extension import limit

2020-01-05 Thread Steve Dower


Steve Dower  added the comment:

I haven't looked into _why_ yet, but the first PYD I grabbed from the GitHub 
link above has had the CRT statically linked. This is not the default (or it 
should not be), because when we made it the default this exact issue occurred :)

If somehow the default linking mode in distutils has changed, we should fix 
that. If it is being overridden by Setuptools or Cython then we should get 
those projects fixed.

Stefan/Paul - do Cython or Setuptools override compiler/linker settings like 
this at all? Most likely it's the /MT vs /MD option

--
nosy: +p-ganssle, scoder

___
Python tracker 

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



[issue39227] OverflowError in len(range(2**63))

2020-01-05 Thread Zac Hatfield-Dodds


New submission from Zac Hatfield-Dodds :

The value for `len` internally passes through an `ssize_t`, which means that it 
raises OverflowError for (very) large collections.

This is admittedly only possible with collections such as `range` that do not 
store all their elements in memory, but it would still be nice to have 
`len(range(n)) == n` without caveats.

This was found via a teaching example and is now tracked in my repo of 
property-based tests for CPython:
https://github.com/rsokl/Learning_Python/pull/125
https://github.com/Zac-HD/stdlib-property-tests/blob/bb46996ca4500381ba09a8cd430caaddd71910bc/tests.py#L28-L34

Related to https://bugs.python.org/issue26423, but it's still present in the 
development branches for 3.7, 3.8, and 3.9; and instead of a wrong result it's 
an error (which is better!).

--
components: Interpreter Core
messages: 359394
nosy: Zac Hatfield-Dodds
priority: normal
severity: normal
status: open
title: OverflowError in len(range(2**63))
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue39211] Change in http.server default IP behavior?

2020-01-05 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Other than addressing issue38907, is there anything else to be done here? In 
GH-17851, I've proposed a surgical fix to address the issue with IPv4 being 
unbound on Windows.

--

___
Python tracker 

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



[issue38907] http.server (command) fails to bind dual-stack on Windows

2020-01-05 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
pull_requests: +17272
pull_request: https://github.com/python/cpython/pull/17851

___
Python tracker 

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



[issue20215] socketserver.TCPServer can not listen IPv6 address

2020-01-05 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
pull_requests: +17274
pull_request: https://github.com/python/cpython/pull/17851

___
Python tracker 

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



[issue25667] Supply dual-stack (IPv4/IPv6) socket bind routine

2020-01-05 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
keywords: +patch
pull_requests: +17273
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17851

___
Python tracker 

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



[issue25872] multithreading traceback KeyError when modifying file

2020-01-05 Thread Michael Graczyk


Michael Graczyk  added the comment:

This issue still exists in Python 3. The repro just needs to be changed so that 
the threads are actually started.

- map(lambda t: t.start(), threads)
- map(lambda t: t.join(), threads)
+ [t.start() for t in threads]
+ [t.join() for t in threads]

My fix is linked.

--
nosy: +Michael Graczyk

___
Python tracker 

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



[issue25872] multithreading traceback KeyError when modifying file

2020-01-05 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

As @xtreak said, this looks like it was fixed for Python 3 and was only an 
issue for 2.7, so I'm closing the issue.

--
nosy: +cheryl.sabella
resolution:  -> wont fix
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



[issue38623] Python documentation should mention how to find site-packages

2020-01-05 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +brett.cannon
versions:  -Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue39225] Python should warn when a global/local has the same name as a builtin

2020-01-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

On the other hand, this would generate a lot of warnings for users of 
libraries, who aren't able to do anything about it. I've got tons of existing 
code that uses the names of builtins as locals, to no harm. And as builtins are 
added, new warnings would pop up.

A linter is really the best way to handle this. Maybe Jupyter could add its own 
warning.

--
nosy: +eric.smith

___
Python tracker 

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



[issue39226] venv does not include pythonXX.lib

2020-01-05 Thread Antonio Vázquez Blanco

New submission from Antonio Vázquez Blanco :

I've tryed to install mod_wsgi using pip lately in a venv. This installation 
process fails with a message about a missing venv\scripts\libs\python38.lib 
file as reported in https://github.com/GrahamDumpleton/mod_wsgi/issues/506

It seems that this file used to be included in virtual environments but the 
behaviour has changed. This library seems to be a dependency for some modules, 
shouldn't it be included in the virtual environment? Is this behaviour change 
desired? If so, how should modules link to python.lib?

Thanks in advance

--
components: Library (Lib)
messages: 359388
nosy: Antonio Vázquez Blanco
priority: normal
severity: normal
status: open
title: venv does not include pythonXX.lib
type: behavior

___
Python tracker 

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



[issue39130] Dict is reversable from v3.8 and should say that in the doc

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset 89947881ac36324148fab75190af453dc09fd862 by Miss Islington (bot) 
in branch '3.8':
bpo-39130: Dict reversed was added in v3.8 so should say in the doc as well 
(GH-17694)
https://github.com/python/cpython/commit/89947881ac36324148fab75190af453dc09fd862


--

___
Python tracker 

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



[issue39130] Dict is reversable from v3.8 and should say that in the doc

2020-01-05 Thread miss-islington


New submission from miss-islington :


New changeset 94d9cfc4ed9dd3c4a3a359bc194b4dc3f6ba63eb by Miss Islington (bot) 
(Khalid Mammadov) in branch 'master':
bpo-39130: Dict reversed was added in v3.8 so should say in the doc as well 
(GH-17694)
https://github.com/python/cpython/commit/94d9cfc4ed9dd3c4a3a359bc194b4dc3f6ba63eb


--
nosy: +miss-islington

___
Python tracker 

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



[issue39130] Dict is reversable from v3.8 and should say that in the doc

2020-01-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17270
pull_request: https://github.com/python/cpython/pull/17848

___
Python tracker 

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



[issue39212] Show qualified function name when giving arguments error

2020-01-05 Thread Ram Rachum


Ram Rachum  added the comment:

Here is a short IPython session:

In [1]: class Foo: 
   ...: def __init__(self, x): 
   ...: pass   
   ...:
   
In [2]: Foo(7, 8)  
---
TypeError Traceback (most recent call last)
 in  
> 1 Foo(7, 8)  
   
TypeError: __init__() takes 2 positional arguments but 3 were given

As you can see, it's pretty simple to get this exception text, so I'm not sure 
why you didn't get that text. This is on Python 3.8.1.

Regarding you saying it's more annoying than useful: Especially for methods 
such as `__init__`, it's often difficult to understand which class is being 
instantiated, especially in a complex codebase. It happened to me last week at 
work, and even with a debugger and being an experienced Python developer, it 
took me a few minutes to figure out which `__init__` method was being called.

--

___
Python tracker 

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



[issue39225] Python should warn when a global/local has the same name as a builtin

2020-01-05 Thread Reuven Lerner


New submission from Reuven Lerner :

Newcomers to Python are often frustrated and surprised when they define 
variables such as "sum" and "list", only to discover that they've masked access 
builtins of the same name.

External code checkers do help, but those don't work in Jupyter or other 
non-IDE environments.

It would be nice if defining a global/local with the same name as a builtin 
would generate a warning.  For example:

list = [10, 20, 30]
RedefinedBuiltinWarning: "list" is a builtin, and should normally not be 
redefined. 

I'm sure that the wording could use a lot of work, but something like this 
would do wonders to help newbies, who encounter this all the time. Experienced 
developers are surprised that these terms aren't reserved words.

--
components: Interpreter Core
messages: 359384
nosy: reuven
priority: normal
severity: normal
status: open
title: Python should warn when a global/local has the same name as a builtin

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Then I suggest to focus on optimizing real code.

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Even if there are cases, we need to prove that they are common enough

I don't think cases for an extended slicing are common enough. In addition to 
stdlib, Django and flask (checked by Batuhan) I checked many popular 3rd party 
packages and there is not an occurrence of the pattern.

--

___
Python tracker 

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



[issue33255] json.dumps has different behaviour if encoding='utf-8' or encoding='utf8'

2020-01-05 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
resolution:  -> wont fix
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



[issue39218] Assertion failure when calling statistics.variance() on a float32 Numpy array

2020-01-05 Thread Reed


Reed  added the comment:

Thank you all for the comments! Either using (x-c)*(x-c), or removing the 
assertion and changing the final line to `return (U, total)`, seem reasonable. 
I slightly prefer the latter case, due to Mark's comments about x*x being 
faster and simpler than x**2. But I am not an expert on this.

> I am inclined to have the stdev of float32 return a float32 is possible. What 
> do you think?

Agreed.

> OTOH, (x-c)*(x-c) repeats the subtraction unnecessarily, but perhaps 
> assignment expressions could rescue us?

Yeah, we should avoid repeating the subtraction. Another method of doing so is 
to define a square function. For example:

def square(y):
return y*y
sum(square(x-c) for x in data)

> Would that also imply intermediate calculations being performed only with 
> float32, or would intermediate calculations be performed with a more precise 
> type?

Currently, statistics.py computes sums in infinite precision 
(https://github.com/python/cpython/blob/422ed16fb846eec0b5b2a4eb3a978c9862615665/Lib/statistics.py#L123)
 for any type. The multiplications (and exponents if we go that route) would 
still be float32.

--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The optimization for constant indexes is handy for things like b'A'[0]. I do 
not know cases for constant slices of constant strings.

Even if there are cases, we need to prove that they are common enough. The 
compiler does not perform all possible constant foldings, it does it only to 
support common cases like 24*60*60 or 2**32-1.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39211] Change in http.server default IP behavior?

2020-01-05 Thread Shane


Shane  added the comment:

Jason, thank you for the primer.

> Nevertheless, when I tried the same thing on my Windows machine, I got a 
> different outcome. The server bound to [::0] but was unreachable on 
> http://127.0.0.1:8000.

Perhaps it's an issue with IPv4 addresses in general for Python 3.8 on Windows 
when they are not directly bound during invocation of the server.  I used to be 
able to reach the server with http://:8080/ (this was my 
initial surprise), but now this behavior doesn't work for me.  However, on 
further testing http://:8080/ DOES work.

--
status: pending -> open

___
Python tracker 

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



[issue38907] http.server (command) fails to bind dual-stack on Windows

2020-01-05 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In issue39211, I've done a good deal of investigation on this issue and 
confirmed your findings - on Windows, the server fails to bind dual stack on 
Windows, but instead binds IPV6ONLY. That needs to be fixed such that the 
default is to bind dual-stack. Adding dual-stack control is a new feature and 
should be considered separately.

--
nosy: +jaraco
title: Add IPv6 Dual-Stack control for http.server -> http.server (command) 
fails to bind dual-stack on Windows

___
Python tracker 

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



[issue39211] Change in http.server default IP behavior?

2020-01-05 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Indeed, if I apply this patch:

```
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 47a4fcf9a6..de995ae4b9 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -1246,6 +1246,11 @@ def test(HandlerClass=BaseHTTPRequestHandler,
 """
 ServerClass.address_family, addr = _get_best_family(bind, port)
 
+def server_bind(self, orig=ServerClass.server_bind):
+self.socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
+return orig(self)
+ServerClass.server_bind = server_bind
+
 HandlerClass.protocol_version = protocol
 with ServerClass(addr, HandlerClass) as httpd:
 host, port = httpd.socket.getsockname()[:2]
```

And then run `python -m http.server`, it binds to `::` but responds on 
`127.0.0.1` on Windows:

```
~ # python -m http.server
Serving HTTP on :: port 8000 (http://[::]:8000/) ... 
:::127.0.0.1 - - [05/Jan/2020 14:48:09] "GET / HTTP/1.1" 200 - 
```

I think the solution is to add a patch similar to that until Python has a 
socketserver that supports dual-stack binding. See related issues issue25667, 
issue20215, issue36208, issue17561, and issue38907.

In fact, since issue38907 captures more concretely what I believe is the main 
issue here, I'm going to use that issue to address the concern. If Windows is 
able to bind dual-stack to IPv6/IPv4, I believe that would address the 
compatibility concern raised herein.

I'm going to mark this as a duplicate, but if you believe there is another 
issue at play here, please don't hesitate to re-open or comment and I can.

--
resolution:  -> duplicate
status: open -> pending
superseder:  -> Add IPv6 Dual-Stack control for http.server

___
Python tracker 

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



[issue39211] Change in http.server default IP behavior?

2020-01-05 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

> It's the addition of flags=socket.AI_PASSIVE on Lib/http/server.py:1233 
> that's causing this.

Can you elaborate? What is it causing?

I can see that flag was added in 
https://github.com/python/cpython/pull/11767/commits/62dbe55c9d88c75868399de9d86bcd947e23951c
 for the purpose of:

> indicate to get the wildcard address (all interfaces).

I don't recall beyond that why I went that route.

I can see in https://github.com/cherrypy/cherrypy/issues/871, CherryPy had to 
add [this 
code](https://github.com/cherrypy/cheroot/blob/420d50c4167be89ee4f5841a493fbd2bb929982e/cheroot/server.py#L1946-L1962)
 to support dual-stack operation. I suspect that's also what Python needs here 
(in addition to a test that binding on :: responds on 127.0.0.1).

--

___
Python tracker 

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



[issue39221] Cross compiled python installed wrong version of lib2to3/Grammar pickle

2020-01-05 Thread Andrew Aladjev


Andrew Aladjev  added the comment:

For now I've created a workaround - just removed python version from pickle 
generator. For my current container it works perfect.

--
keywords: +patch
Added file: 
https://bugs.python.org/file48828/remove_python_version_from_pickle.patch

___
Python tracker 

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



[issue39211] Change in http.server default IP behavior?

2020-01-05 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

First, a quick primer in IP:

- Addresses are written as :::::::, but any 
single span of zeros can be written as ::, so `::` is all zeros and `::1` is 
the same as :::::::0001.
- ::1 is the local host (the some machine as where the code is running), 
equivalent to 127.0.0.1 in IPv4.
- To listen on all interfaces, the socket library expects the system to bind to 
0.0.0.0 (IPv4) or :: (IPv6).
- When specified in a URL, an IPv6 address must be wrapped in [] to distinguish 
the `:` characters from the port separator. For example, http://[::1]:8000/ 
specifies connect to localhost over IPv6 on port 8000.
- If the system supports dual-stack IPv4 over IPv6, all IPv4 addresses are 
mapped to a specific IPv6 subnet, so binding/listening on IPv6 often allows a 
client to connect to IPv4.
- Even if the server is listening on all interfaces (0.0.0.0/::), the client 
must specify an internet address that will reach that address.

As a result of this last point, it's not possible for a server like http.server 
to reliably know what address a client would be able to use to connect to the 
server. That is, if the server is bound on all interfaces, a local client could 
connect over localhost/127.0.0.1/::1 (assuming that interface exist, which it 
doesn't sometimes) or to another address assigned  by the host, e.g. 
2601:547:501:6ba:d1e6:300d:7e83:6b6f. A client on another host, however, would 
not be able to use localhost to connect to the server. It _must_ use an address 
that's both assigned to the server's host, bound by the server, and routeable 
to/from the client (i.e. not blocked by a firewall).

Prior to Python 3.8, the default behavior was to bind to all interfaces on IPv4 
only, which was unnecessarily limiting, but was subject to the same unexpected 
behavior:

```
draft $ python3.7 -m http.server

 
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
```

The URL there `http://0.0.0.0:8000/` has the same failure mode as the one 
described above. One cannot browse to that address, but must replace `0.0.0.0` 
with `localhost` or `127.0.0.1` (to connect from localhost) or replace with a 
routable address to connect from another host. The only difference is that with 
Python 3.8, now IPv6 is honored.

Note if one passes `localhost` or `127.0.0.1` or `::1` as the bind parameter, 
the URL indicated would work:

```
draft $ python -m http.server --bind localhost  

 
Serving HTTP on ::1 port 8000 (http://[::1]:8000/) ...
```

Since it's not possible in general to supply the URL a client would need to 
connect to the server, it's difficult to reliably provide a useful URL.

Some web servers do apply [a 
heuristic](https://github.com/jaraco/portend/blob/754c37046d86d178d20faa8dbfe910482d79bdff/portend.py#L27-L46)
 that translates "all addresses" to a "localhost" address, and Python stdlib 
could implement that heuristic.

> On 3.7.X I was able to use it as described in the docs and it would default 
> to whatever IP address was available.

That behavior should be the same, except that it should now bind to both IPv6 
and IPv4. If you previously ran without any parameters, it would bind to all 
interfaces on IPv4. Now it binds on all interfaces on IPv6, which should be 
backward compatible in dual-stack environments like Windows. You just have to 
translate `[::]` to `localhost` instead of translating `0.0.0.0` to `localhost`.


When I tested your findings on macOS, everything worked as I expected. I 
launched the server with `python -m http.server`, and the site could be reached 
on http://localhost:8000/ and http://127.0.0.1:8000 and http://[::1]:8000/. 
Nevertheless, when I tried the same thing on my Windows machine, I got a 
different outcome. The server bound to [::0] but was unreachable on 
http://127.0.0.1:8000.

That was unexpected, and I'll try to ascertain why the dual-stack behavior 
isn't working as I'd expect.

--
nosy:  -SilentGhost
stage: needs patch -> 

___
Python tracker 

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



[issue39220] constant folding affects annotations despite 'from __future__ import annotations'

2020-01-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Yo be honest, this would add a lot of complexity as "from __future__ import 
annotations" is a compiler directive (CO_FUTURE_ANNOTATIONS) and bringing this 
to the AST level would be somehow disrupting. 

I would be -1 to disable AST optimizations in annotations.

--

___
Python tracker 

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



[issue39220] constant folding affects annotations despite 'from __future__ import annotations'

2020-01-05 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Łukasz, should we disable AST optimizations in annotations if "from __future__ 
import annotations" is used?

--
nosy: +pablogsal -BTaskaya

___
Python tracker 

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



[issue39224] HTTPConnection.timeout None support

2020-01-05 Thread Daniel Farley


Change by Daniel Farley :


--
keywords: +patch
pull_requests: +17269
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17843

___
Python tracker 

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



[issue39221] Cross compiled python installed wrong version of lib2to3/Grammar pickle

2020-01-05 Thread Ned Deily


Change by Ned Deily :


--
nosy: +doko

___
Python tracker 

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



[issue39224] HTTPConnection.timeout None support

2020-01-05 Thread Daniel Farley


New submission from Daniel Farley :

HTTPConnection's `timeout` argument is passed down to `socket.settimeout()` 
which supports `None` and puts the socket in blocking mode. This isn't 
documented on the `http.client` page. Otherwise it should not be allowed.

--
assignee: docs@python
components: Documentation
messages: 359371
nosy: Daniel Farley, docs@python
priority: normal
severity: normal
status: open
title: HTTPConnection.timeout None support
type: behavior

___
Python tracker 

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



[issue39220] constant folding affects annotations despite 'from __future__ import annotations'

2020-01-05 Thread Batuhan


Change by Batuhan :


--
nosy: +BTaskaya -lukasz.langa

___
Python tracker 

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



[issue39220] constant folding affects annotations despite 'from __future__ import annotations'

2020-01-05 Thread Batuhan


Change by Batuhan :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue39220] constant folding affects annotations despite 'from __future__ import annotations'

2020-01-05 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Batuhan


Batuhan  added the comment:

It looks like we have some usage for normal indexing (not this PR, the original 
optimization);

cpython/cpython/Lib/base64.py:382
cpython/cpython/Lib/base64.py:382
cpython/cpython/Lib/base64.py:393
cpython/cpython/Lib/base64.py:397
cpython/cpython/Lib/pickle.py:306
cpython/cpython/Lib/pickle.py:1291
cpython/cpython/Lib/glob.py:155
cpython/cpython/Lib/test/test_mmap.py:59
cpython/cpython/Lib/test/test_mmap.py:63
cpython/cpython/Lib/test/test_mmap.py:574
cpython/cpython/Lib/test/test_codecs.py:2317
cpython/cpython/Lib/test/test_codecs.py:2323
cpython/cpython/Lib/test/test_contextlib.py:1025
cpython/cpython/Lib/test/test_struct.py:645

--

___
Python tracker 

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



[issue31485] Tkinter widget.unbind(sequence, funcid) unbind all bindings

2020-01-05 Thread Giovanni Lombardo


Giovanni Lombardo  added the comment:

I propose the below fix:

```
def unbind(self, sequence, funcid=None):
"""Unbind for this widget for event SEQUENCE  the
function identified with FUNCID."""
bound = ''
if funcid:
self.deletecommand(funcid)
funcs = self.tk.call('bind', self._w, sequence, None).split('\n')
bound = '\n'.join([f for f in funcs if not f.startswith('if 
{{"[{0}'.format(funcid))])
self.tk.call('bind', self._w, sequence, bound)
```

--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The one in cpython/Tools/clinic/clinic.py:1185 is sort of an anti-pattern as it 
should be using 

'''\
Something something
'''

instead of skipping the newline.

--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I was reading the pull request and I have to say that I find using a switch 
instead of a very crowded "if" ward a bit more readable.

I would be +0 on this case.

--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Batuhan


Batuhan  added the comment:

I've scanned stdlib, django and flask and no usage so far. There is one in the 
test (which basically verifies behavior of slice) and one in the argument 
clinic which passes the newline for a multiline string. 

cpython/Tools/clinic/clinic.py:1185
cpython/Lib/test/test_descr.py:3789

--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Batuhan


Batuhan  added the comment:

> Then I'd suggest removing the optimization for "abcde"[2], too. I've never 
> seen this in real code, and I can't come up with a scenario where it would be 
> performance critical. Remember, one of the goals for CPython is to be 
> reasonable readable, not maximally tricky.

I dont think this patch will decrease readability and make code complex.

> Could you point to the code (or ideally the commit) with methane's comment?
https://github.com/python/cpython/blob/master/Python/ast_opt.c#L319 (PR 2858)

--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

Then I'd suggest removing the optimization for "abcde"[2], too. I've never seen 
this in real code, and I can't come up with a scenario where it would be 
performance critical. Remember, one of the goals for CPython is to be 
reasonable readable, not maximally tricky.

Could you point to the code (or ideally the commit) with methane's comment?

I'm not trying to be a jerk, though. I do appreciate your patch, I just think 
it's not appropriate for CPython.

--

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 4b66fa6ce9c37e70b55af220d0e07368319de803 by Pablo Galindo in 
branch 'master':
bpo-39200: Correct the error message for range() empty constructor (GH-17813)
https://github.com/python/cpython/commit/4b66fa6ce9c37e70b55af220d0e07368319de803


--

___
Python tracker 

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



[issue34480] _markupbase.py fails with UnboundLocalError on invalid keyword in marked section

2020-01-05 Thread Berker Peksag


Berker Peksag  added the comment:

> _markupbase.py is internal, so it should be safe to remove
> ParserBase.error() and the code that calls it as suggested in #31844

Should I reopen https://github.com/python/cpython/pull/8562 then?

--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Batuhan


Batuhan  added the comment:

We already have a folding operation for Index access ("abcde"[2]) and there was 
a todo (left by @methane I guess) about supporting other slicings. I think this 
would look inconsistent if one is support and not the other one.

--

___
Python tracker 

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



[issue39174] unicodedata.normalize failing with NFD and NFKD for some characters in Python3

2020-01-05 Thread Lee Collins


Lee Collins  added the comment:

I did some more investigation by running cat on a file with the decomposed 
characters and saw that the output was composed. So, this does look like a 
problem with the Mac OS terminal. It can be resolved as 3rd party

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-05 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Specially because you need to do the mental calculation to know what the 
indexes are for the letters you want, and at that point you better write that 
string anyways, no?

--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am with Eric. Why would anyone write:


"abcde"[2:4]

Instead of just

cd

?

--
nosy: +pablogsal

___
Python tracker 

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



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset 636a850ed81cf9b8feed523f277b1538bfc5230b by Miss Islington (bot) 
in branch '3.8':
bpo-39152: add missing ttk.Scale.configure return value (GH-17815)
https://github.com/python/cpython/commit/636a850ed81cf9b8feed523f277b1538bfc5230b


--

___
Python tracker 

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



[issue34480] _markupbase.py fails with UnboundLocalError on invalid keyword in marked section

2020-01-05 Thread Ezio Melotti

Ezio Melotti  added the comment:

HTMLParser is supposed to follow the HTML5 standard, and never raise an error.

For the example in the first comment (""), the steps should be:

* https://html.spec.whatwg.org/multipage/parsing.html#data-state:tag-open-state
* 
https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state:markup-declaration-open-state
* 
https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state:bogus-comment-state
* https://html.spec.whatwg.org/multipage/parsing.html#bogus-comment-state

I agree that the error should be fixed by setting `match` to None, and a test 
case that triggers the UnboundLocalError (before the fix) should be added as 
well (what provided by Karthikeyan looks good).

However, it also seems wrong that HTMLParser ends up calling self.error() 
through  Lib/_markupbase.py ParserBase after HTMLParser.error() and all the 
calls to it have been removed.  _markupbase.py is internal, so it should be 
safe to remove ParserBase.error() and the code that calls it as suggested in 
#31844 (and possibly to merge _markupbase into html.parser too).  Even if this 
is done and the call to self.error() is removed from 
ParserBase.parse_marked_section(), `match` still needs to be set to None 
(either in the `else` branch or before the `if/elif` block).

--

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


[issue39211] Change in http.server default IP behavior?

2020-01-05 Thread SilentGhost


SilentGhost  added the comment:

It's the addition of flags=socket.AI_PASSIVE on Lib/http/server.py:1233 that's 
causing this. I think this also breaks for IPv4 sockets.

--
components: +Library (Lib)
keywords: +3.8regression
nosy: +SilentGhost
stage:  -> needs patch

___
Python tracker 

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



[issue39216] ast_opt.c -- missing posonlyargs?

2020-01-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks again for the fix and the investigation!

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



[issue39216] ast_opt.c -- missing posonlyargs?

2020-01-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17268
pull_request: https://github.com/python/cpython/pull/17841

___
Python tracker 

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



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset 6234301bb56a9b388a1c3bf51169a2762ea09172 by Miss Islington (bot) 
in branch '3.7':
bpo-39152: add missing ttk.Scale.configure return value (GH-17815)
https://github.com/python/cpython/commit/6234301bb56a9b388a1c3bf51169a2762ea09172


--
nosy: +miss-islington

___
Python tracker 

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



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17267
pull_request: https://github.com/python/cpython/pull/17840

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

Does this occur often enough that it's worth the added code?

--
nosy: +eric.smith

___
Python tracker 

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



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17266
pull_request: https://github.com/python/cpython/pull/17839

___
Python tracker 

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



[issue39152] Faulty override of tkinter.Misc.configure in tkinter.ttk.Scale.configure

2020-01-05 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 5ea7bb25e3b192d6c49a49c9e3b316f8559602aa by Terry Jan Reedy in 
branch 'master':
bpo-39152: add missing ttk.Scale.configure return value (GH-17815)
https://github.com/python/cpython/commit/5ea7bb25e3b192d6c49a49c9e3b316f8559602aa


--

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Batuhan


Change by Batuhan :


--
keywords: +patch
pull_requests: +17265
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17838

___
Python tracker 

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



[issue39223] Fold constant slicing with slices

2020-01-05 Thread Batuhan


New submission from Batuhan :

>>> def g(): "abcde"[2:4]
... 
>>> g.__code__.co_consts
(None, 'abcde', 2, 4)

to 

>>> def g(): "abcde"[2:4]
... 
>>> g.__code__.co_consts
(None, 'cd')

(I have a patch)

--
components: Interpreter Core
messages: 359350
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: Fold constant slicing with slices
versions: Python 3.9

___
Python tracker 

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



[issue39211] Change in http.server default IP behavior?

2020-01-05 Thread Shane


Shane  added the comment:

A small update:

Using the direct invocation:

> python -m http.server 8000
Serving HTTP on :: port 8080 (http://[::]:8080/) ...

Is NOT accessible at the following addresses:
http://[::]:8080/  # most surprising, because this is where it tells you to go
http://:8080/  # this was the Python <= 3.7 behavior, as I used 
it anyhow

But it IS accessible at the following addresses:
http://[::1]:8080/
http://localhost:8080/


There may be others I don't know about.  I recognize that my difficulties 
likely arise from a lack of familiarity with internet protocols, as this isn't 
something I use with any kind of regularity.  But I do think it's possible (and 
desirable) for the method to be as casual-friendly as it was in Python 3.7.

Specifically, the direct invocation tells the user they can go to 
http://[::]:8080/, which they cannot.  They CAN go to http://[::1]:8080/.  
Should this instead be the message returned on direct invocation?

So far as I can tell, this is still a behavior change, as the old behavior was 
accessible from your IP address and therefore visible to other computers on the 
network (I assume localhost is not).  But it would at least do what it says on 
the tin.

--

___
Python tracker 

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



[issue39222] unittest.mock.Mock.parent is broken or undocumented

2020-01-05 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue39222] unittest.mock.Mock.parent is broken or undocumented

2020-01-05 Thread Florian Brucker


New submission from Florian Brucker :

The "parent" attribute of unittest.mock.Mock is either broken or undocumented.

For example, on Python 3.7.4:

>>> from unittest.mock import Mock
>>> m = Mock(x=1, parent=2)
>>> m.x
1
>>> m.parent
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.7/unittest/mock.py", line 659, in __repr__
name = self._extract_mock_name()
  File "/usr/local/lib/python3.7/unittest/mock.py", line 638, in 
_extract_mock_name
_name_list.append(_parent._mock_new_name + dot)
AttributeError: 'int' object has no attribute '_mock_new_name'
>>> parent = Mock()
>>> child = Mock(parent=parent)
>>> child.parent is parent
False

I stumbled upon this while trying to mock an object that has a "parent" 
attribute.

>From the documentation I understand that mocks have built-in parents. However, 
>the documentation never mentions the "parent" attribute specifically, so I 
>always assumed that the built-in parent-child relationship was handled using 
>private or name-mangled attributes. And since the "parent" attribute is not 
>mentioned in the docs, I assumed I could set it by passing an additional kwarg 
>to Mock.

I would have expected one of the following, in order of personal preference:

a) That a private or name-mangled attribute is used for the built-in 
parent-child relationship, so that I can mock objects which themselves have a 
"parent" attribute

b) That the special meaning of the "parent" attribute is documented, and that 
trying to set it directly (via the constructor or via attribute assignment, and 
without going through attach_mock) triggers a warning.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 359348
nosy: docs@python, florian.brucker
priority: normal
severity: normal
status: open
title: unittest.mock.Mock.parent is broken or undocumented
type: behavior
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



[issue39216] ast_opt.c -- missing posonlyargs?

2020-01-05 Thread Anthony Sottile


Change by Anthony Sottile :


--
keywords: +patch
pull_requests: +17264
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17837

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2020-01-05 Thread Bruce Merry


Bruce Merry  added the comment:

I ran the test on a Xeon machine (Skylake-XP) and it also looks like 
performance is only improved from 1MB up (somewhat to my surprise, given how 
poor single-threaded memcpy performance is on that machine). So I've updated 
the pull request with that threshold.

--

___
Python tracker 

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



[issue37685] Fix equality checks for some types

2020-01-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +17263
pull_request: https://github.com/python/cpython/pull/17836

___
Python tracker 

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



[issue32856] Optimize the `for y in [x]` idiom in comprehensions

2020-01-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I want to merge PR 16814 if there are no objections.

--

___
Python tracker 

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



[issue39197] argparse: title and description for mutually exclusive arg groups

2020-01-05 Thread hai shi


hai shi  added the comment:

Do you have user case for it?

_ArgumentGroup have the `title` attribute, so  _MutuallyExclusiveGroup add same 
attribute is not a big probleam(if user really need it).

--
nosy: +shihai1991

___
Python tracker 

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



[issue39221] Cross compiled python installed wrong version of lib2to3/Grammar pickle

2020-01-05 Thread Andrew Aladjev


Andrew Aladjev  added the comment:

This is build.log:

https://gist.githubusercontent.com/andrew-aladev/f36e8e754278e4fad50ff13238326f7a/raw/245a72e8bd0fb3dc6e4185ec757b2d3ab59d5861/gistfile1.txt

We can see that python installed "Grammar3.6.9.final.0.pickle" instead of 
"Grammar3.6.10.final.0.pickle"

--

___
Python tracker 

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



[issue39221] Cross compiled python installed wrong version of lib2to3/Grammar pickle

2020-01-05 Thread Andrew Aladjev


New submission from Andrew Aladjev :

Please see the following gentoo bug https://bugs.gentoo.org/704816

https://github.com/python/cpython/blob/master/Lib/lib2to3/pgen2/driver.py#L110

> head + tail + ".".join(map(str, sys.version_info)) + ".pickle"

I've tried "print(sys.version_info)" during compilation and received:
> sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)

"sys.version_info" is not the target python version, this is the version of 
python that is running compilation. This variable needs to be replace with 
something like "sys.target_python_version".

This issue looks simple but I can't fix it by myself. Please assign this issue 
to core developer. We need to find all places where "sys.version_info" is used 
as target python version during compilation and replace it.

--
components: Library (Lib)
messages: 359343
nosy: puchenyaka
priority: normal
severity: normal
status: open
title: Cross compiled python installed wrong version of lib2to3/Grammar pickle
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue39056] Issues with handling the -W option

2020-01-05 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



[issue39055] base64.b64decode() with validate=True does not raise for a trailing \n

2020-01-05 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



[issue39057] Issues with urllib.request.proxy_bypass_environment

2020-01-05 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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-01-05 Thread hai shi


hai shi  added the comment:

One part of this issue is that all C extensions of the stdlib should be updated 
to implement the PEP 489 "Multi-phase extension module initialization".
> I try to port _json extension module to multiphase initialization module, but 
> the baseline(using victor's code) in my vm not changed~

--
nosy: +shihai1991

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-01-05 Thread hai shi


Change by hai shi :


--
keywords: +patch
pull_requests: +17262
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/17835

___
Python tracker 

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



[issue39220] constant folding affects annotations despite 'from __future__ import annotations'

2020-01-05 Thread Carl Friedrich Bolz-Tereick


New submission from Carl Friedrich Bolz-Tereick :

PEP 563 interacts in weird ways with constant folding. running the following 
code:

```
from __future__ import annotations

def f(a: 5 + 7) -> a ** 39:
return 12

print(f.__annotations__)
```

I would expect this output:

```
{'a': '5 + 7', 'return': 'a ** 39'}
```

But I get:


```
{'a': '12', 'return': 'a ** 39'}
```

--
components: Interpreter Core
files: x.py
messages: 359341
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: constant folding affects annotations despite 'from __future__ import 
annotations'
versions: Python 3.7
Added file: https://bugs.python.org/file48827/x.py

___
Python tracker 

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



[issue39055] base64.b64decode() with validate=True does not raise for a trailing \n

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset 34aa3e71dc52c1a31336302905b9ac011a310412 by Miss Islington (bot) 
in branch '3.8':
bpo-39055: Reject a trailing \n in base64.b64decode() with validate=True. 
(GH-17616)
https://github.com/python/cpython/commit/34aa3e71dc52c1a31336302905b9ac011a310412


--

___
Python tracker 

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



[issue39056] Issues with handling the -W option

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset 43fbc70360b2a934ea809b2175d7e99031db2df3 by Miss Islington (bot) 
in branch '3.7':
bpo-39056: Fix handling invalid warning category in the -W option. (GH-17618)
https://github.com/python/cpython/commit/43fbc70360b2a934ea809b2175d7e99031db2df3


--

___
Python tracker 

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



[issue39056] Issues with handling the -W option

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset e1caa49f68dd63b534774aebad0c240143e6fb5d by Miss Islington (bot) 
in branch '3.8':
bpo-39056: Fix handling invalid warning category in the -W option. (GH-17618)
https://github.com/python/cpython/commit/e1caa49f68dd63b534774aebad0c240143e6fb5d


--
nosy: +miss-islington

___
Python tracker 

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



[issue39055] base64.b64decode() with validate=True does not raise for a trailing \n

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset 3bdb2d9daf3ce41b325bd508e3dd29041e85dd1f by Miss Islington (bot) 
in branch '3.7':
bpo-39055: Reject a trailing \n in base64.b64decode() with validate=True. 
(GH-17616)
https://github.com/python/cpython/commit/3bdb2d9daf3ce41b325bd508e3dd29041e85dd1f


--
nosy: +miss-islington

___
Python tracker 

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



[issue39057] Issues with urllib.request.proxy_bypass_environment

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset fc84d501b9d77701cbdd485de45e200bf027c0e9 by Miss Islington (bot) 
in branch '3.8':
bpo-39057: Fix urllib.request.proxy_bypass_environment(). (GH-17619)
https://github.com/python/cpython/commit/fc84d501b9d77701cbdd485de45e200bf027c0e9


--

___
Python tracker 

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



[issue39057] Issues with urllib.request.proxy_bypass_environment

2020-01-05 Thread miss-islington


miss-islington  added the comment:


New changeset 880a17af7d063fcef225a46b7f4ae35d792b2f11 by Miss Islington (bot) 
in branch '3.7':
bpo-39057: Fix urllib.request.proxy_bypass_environment(). (GH-17619)
https://github.com/python/cpython/commit/880a17af7d063fcef225a46b7f4ae35d792b2f11


--
nosy: +miss-islington

___
Python tracker 

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



[issue39055] base64.b64decode() with validate=True does not raise for a trailing \n

2020-01-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17261
pull_request: https://github.com/python/cpython/pull/17834

___
Python tracker 

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



  1   2   >