[issue31815] Make itertools iterators interruptible

2018-06-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't think a new public API should be introduced.  This is at best an 
implementation detail.  

Also, I really don't want to garbage-up the inner-loop code for the itertools.  
I've spent a good deal of time micro-optimizing this code and don't want to 
throw it away for something that is of nearly zero value and imo not a real 
issue that affects real users.

Marking this a closed for now.  We can discuss it more at the sprints (Python 
3.8 is still a long way away).

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



[issue33897] Add a restart option to logging.basicConfig()

2018-06-23 Thread Vinay Sajip


Vinay Sajip  added the comment:

OK, let's go with "force", then. There are plenty of other places in Python 
where it's used, so there's that:

https://github.com/python/cpython/search?l=Python=force

--

___
Python tracker 

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



[issue31815] Make itertools iterators interruptible

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

The purpose would be two-fold:

1. The presence of the `check_signals()` wrapper provides a way to more 
explicitly document that the other itertools iterators *don't* implicitly check 
for signals, so if you want to combine them with consumers that also don't 
check for signals, then you're going to need to wrap the iterator.

2. As a helper for integration code that's dealing with consumers that don't 
check for signals, but want to make those loops interruptible. Doing that in 
Python (as in my example) is inefficient, since you end up running Python 
bytecode on every iteration, and also don't have as much control over exactly 
when the signals get checked.

Given a solution to issue 33939, I'd drop the priority on this issue to low, 
but I don't think it would make it redundant.

--

___
Python tracker 

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



[issue31815] Make itertools iterators interruptible

2018-06-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> What if itertools were to offer an opt-in ...

This doesn't make sense to me.  As far as I can tell, the only time this issue 
has ever arisen in the past 15 or 16 years is when someone was trying to create 
an unbreakable infinite loop on-purpose.  In a way, it is no more interesting 
than intentionally triggering a seqfault with ctypes or bytecode hacks.  
Likewise, it isn't even unique to itertools -- it shows up in any potentially 
long running C-code such as numpy/scipy calls.

I would like to close this issue and instead go down the path of issue 33939 
which would allow consumers to detect when an input expects to be infinite.  
The consumers can then decide whether they want to make periodic cntl-c checks.

--
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue33939] Provide a robust O(1) mechanism to check for infinite iterators

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

Thinking about the generator-iterator case a bit more, "False" would be a bad 
default for that. Allowing "NotImplemented" to indicate the ambiguous "Might be 
finite, might be infinite" state, and using that as the default for 
generator-iterators, would probably make sense.

--

___
Python tracker 

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



[issue31815] Make itertools iterators interruptible

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

As a potential stepping stone towards possible future changes in the default 
behaviour here, what if itertools were to offer an opt-in "check_signals(itr, 
*, iterations=100_000)" helper function that was essentially a more efficient 
version of::

def check_signals(itr, *iterations=100_000):
while True:
next_slice = islice(itr, iterations)
for count, item in enumerate(next_slice, 1):
yield item
if count < iterations:
raise StopIteration

This would:

1. Provide a straightforward way for folks to explicitly opt-in to periodic 
signal checks
2. Provide a way to check for potential compatibility issues with other 
libraries and components to better assess the risks of switching the default 
behaviour

--

___
Python tracker 

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



[issue33939] Provide a robust O(1) mechanism to check for infinite iterators

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

(I've updated the issue title to state the design requirement, rather than one 
potential solution to the design requirement)

I like the declarative `__infinite_iterator__` suggestion, as that's:

1. really easy to implement when defining a custom iterator type (whether in 
Python or in an extension module

2. relatively easy to add to generator-iterators as a read-write property that 
defaults to False (which could then be set to True via an 
"itertools.infinite_generator" decorator)

3. relatively easy to support in iterators like map, filter, etc via a property 
that delegates the response to the underlying iterator

4. even more complex iterators like chain, product, and combinations would be 
able to define a property based on "any(itr.__infinite__iterator__ in 
underyling_iterators)"

--
title: Raise OverflowError in __length_hint__ for consistently infinite 
iterators -> Provide a robust O(1) mechanism to check for infinite iterators

___
Python tracker 

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



[issue33451] Start pyc file lock the file

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset 56aaef0ddba6275b8043b58433739a64497f33b4 by Miss Islington (bot) 
in branch '3.7':
bpo-33451: Close pyc files before calling PyEval_EvalCode() (GH-7884)
https://github.com/python/cpython/commit/56aaef0ddba6275b8043b58433739a64497f33b4


--
nosy: +miss-islington

___
Python tracker 

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



[issue33934] locale.getlocale() seems wrong when the locale is yet unset (python3 on linux)

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

This statement is no longer correct: "when python starts, it runs using the C 
locale, on any platform (Windows, Linux, BSD), any python version (2, 3...), 
until locale.setlocale() is used to set another locale."

The Python 3 text model doesn't work properly in the legacy C locale due to the 
assumption of ASCII as the preferred text encoding, so we run setlocale(LC_ALL, 
"") early in the startup sequence in order to switch to something more 
sensible. In Python 3.7+, we're even more opinionated about that, and 
explicitly coerce the C locale to a UTF-8 based one if there's one available.

If our docs are still saying otherwise anywhere, then our docs are outdated, 
and need to be fixed.

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

___
Python tracker 

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



[issue33919] Expose _PyCoreConfig structure to Python

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

Back on the original hash seed topic:

1. The exact size of the seed ranges from 128 bits (SIPHash) to 32-bits 
depending on exactly which hash algorithm you're talking about 
(https://www.python.org/dev/peps/pep-0456/#hash-secret)

2. While PEP 456 doesn't state it explicitly, my recollection is that omitting 
the exact hash seed value from the Python level API was a deliberate decision, 
since one of the *purposes* of PEP 456 was to protect against seed recovery 
attacks like https://131002.net/siphash/poc.py. Being able to read the seed 
directly from the sys modules would rather simplify the task of seed recovery :)

Only exposing a `forced_hash_seed` (and hiding randomly generated ones as 
`forced_hash_seed=None`) seems reasonable though, since those can already be 
read from os.environ anyway.

--

___
Python tracker 

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



[issue33451] Start pyc file lock the file

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7497

___
Python tracker 

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



[issue33451] Start pyc file lock the file

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7496

___
Python tracker 

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



[issue33451] Start pyc file lock the file

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:


New changeset ea737751b10fff752aafed0231e8a02b82ba365d by Nick Coghlan (Zackery 
Spytz) in branch 'master':
bpo-33451: Close pyc files before calling PyEval_EvalCode() (GH-7884)
https://github.com/python/cpython/commit/ea737751b10fff752aafed0231e8a02b82ba365d


--

___
Python tracker 

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



[issue33919] Expose _PyCoreConfig structure to Python

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

I'm thoroughly open to co-author requests for PEP 432 - the "Let's implement it 
as a private API for Python 3.7 and see what we learn from the experience" plan 
worked beautifully, but it *also* means the PEP text is now woefully out of 
date with reality :)

The pieces that are missing are:

- bring it up to date with what we actually did for 3.7
- decide which of those pieces we want to make public as-is, and which we want 
to tweak before making them generally available (e.g. does the 
"ConfigureMainInterpreter" naming still make sense? Or should we go back to the 
earlier "BeginInitialization" and "EndInitialization" pair?)
- now that we store this state in a more coherent way, what do we want to make 
public at the Python layer, and where should we make it public to avoid causing 
too many problems for other implementations? 

However, while I'd definitely be able to make time to review a PR to the PEP, I 
can't make any promises as to when I'd be able to sit down and actually draft 
that update myself.

--

___
Python tracker 

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



[issue33885] doc Replace "hook function" with "callable" in urllib.request.urlretrieve

2018-06-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The bots occasionally miss.
PR 7885 was indeed merged even though the message has not appeared.
https://github.com/python/cpython/commit/2c11e23a5a686edc69bcbb4c65f500d50d992bb3
PR 7886 was merged as the message says, even though the status was not changed.

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



[issue33885] doc Replace "hook function" with "callable" in urllib.request.urlretrieve

2018-06-23 Thread Senthil Kumaran

Senthil Kumaran  added the comment:


New changeset 0ba9a0b7d19da8b4bd3c13b358d3fd2a5ad16f09 by Senthil Kumaran 
(Andrés Delfino) in branch 'master':
[master] bpo-33885: Replace "hook function" with "callable" (GH-7765) (#7886)
https://github.com/python/cpython/commit/0ba9a0b7d19da8b4bd3c13b358d3fd2a5ad16f09


--

___
Python tracker 

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



[issue33885] doc Replace "hook function" with "callable" in urllib.request.urlretrieve

2018-06-23 Thread Andrés Delfino

Change by Andrés Delfino :


--
pull_requests: +7495

___
Python tracker 

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



[issue33885] doc Replace "hook function" with "callable" in urllib.request.urlretrieve

2018-06-23 Thread Andrés Delfino

Change by Andrés Delfino :


--
pull_requests: +7494

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2018-06-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

Brett pointed out that may initial reaction above came across as quite blunt 
and demanding, so attempting to phrase that more clearly as a user experience 
consideration:

It may be tempting to view this as purely a clean-up of the import system 
implementation, removing a quirky and error prone construct for the sake of 
improved maintainability of both the import system itself, and the 
maintainability of end user installations.

My request (wearing my "BDFL-delegate for packaging interoperability standards" 
hat) is that proponents of the change resist the temptation to view the problem 
that way :)

Path files are used extensively across the Python packaging ecosystem to 
implement additional environment management features beyond those provided 
natively by interpreter implementations, and while we've added native 
equivalents for some of them (namespace packages, virtual environments), we're 
far from having added support for all of them (dynamic package version 
selection, virtual environment chaining, editable package installs that still 
publish correct PEP 376 package metadata, etc).

This means that any changes in this area pose significant backwards 
compatibility risks, and need to be approached carefully, and cautiously, with 
a strong emphasis on surveying real world code and seeing how the feature is 
currently being used.

Or, alternatively, the idea can be broken up into smaller, lower impact changes 
that still help to address the import system and end user environment 
maintainability issues, but don't involve breaking backwards compatibility.

(For an example of the latter: if "python -m site --list-pth-files" printed a 
list of all of the pth files and "python -m site --dump-pth-files" listed both 
the files and their contents, then environment debuggability would improve 
significantly without any compatibility impacts whatsoever)

--

___
Python tracker 

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



[issue33948] doc truncated lines in PDF

2018-06-23 Thread Mikhail


Mikhail  added the comment:

This file was taken from

https://docs.python.org/3.7/archives/python-3.7.0rc1-docs-pdf-a4.zip

Hashes 

CRC32: 327CF408
MD5: 7EBEB565C1EA7E52F366B5C734500FAC
SHA-1: 09727C07C45965E4E43664B727E7CAECC4F3CD89
SHA-256: 3EB1E769F3A1F17922B3BC99AE5C316209E74B7CB6CBE4B4769D55D859AC5BC8
SHA-512: 
EB60766B2C594BD86CF2C038147AF50462DFC379F7DA88C0A89F8791ED0332F67986DA6D328549B463E6CD5A0630F1ECDC140E6DE2C769EE20799C03384F0A2C
SHA3-256: 136575BABCC4B666E39AEBD9E96D09684EE677EDC01825C4D891E141D43CC252

Thank you

--

___
Python tracker 

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



[issue33897] Add a restart option to logging.basicConfig()

2018-06-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Not sure what the best word would be (freshen, update, reconfigure, reset, and 
restart all communicate the intent).  I can't think of a simple word that 
accurately describes the implementation which removes and closes all root 
handlers.

--

___
Python tracker 

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



[issue33851] 3.7 regression: ast.get_docstring() for a node that lacks a docstring

2018-06-23 Thread Ned Deily


Ned Deily  added the comment:

@mgedmin, Just to be certain, are you able to verify that the change in PR 7701 
fixes the problem you see with 3.7.0rc1?

--

___
Python tracker 

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



[issue33948] doc truncated lines in PDF

2018-06-23 Thread Ned Deily


Change by Ned Deily :


--
nosy: +mdk

___
Python tracker 

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



[issue33897] Add a restart option to logging.basicConfig()

2018-06-23 Thread Vinay Sajip


Vinay Sajip  added the comment:

> Perhaps "clear_handlers" or "replace_handlers" would be more self-descriptive.

Except that it doesn't *just* clear the handlers - the act of clearing also 
lets e.g. the level to be set and the formatting to be set by the call.

--

___
Python tracker 

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



[issue33950] IDLE htest: remove spec for deleted tabbedpages.py

2018-06-23 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



[issue33950] IDLE htest: remove spec for deleted tabbedpages.py

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset 7729d6d27d5d31b9764dec4a96a458015be3ecb8 by Miss Islington (bot) 
in branch '3.6':
bpo-33950: Remove IDLE htest spec for a deleted file. (GH-7881)
https://github.com/python/cpython/commit/7729d6d27d5d31b9764dec4a96a458015be3ecb8


--

___
Python tracker 

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



[issue33950] IDLE htest: remove spec for deleted tabbedpages.py

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset 6b7ed31cf9d89a5ffcb3ab438dfd4760b781c488 by Miss Islington (bot) 
in branch '3.7':
bpo-33950: Remove IDLE htest spec for a deleted file. (GH-7881)
https://github.com/python/cpython/commit/6b7ed31cf9d89a5ffcb3ab438dfd4760b781c488


--
nosy: +miss-islington

___
Python tracker 

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



[issue33451] Start pyc file lock the file

2018-06-23 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue33950] IDLE htest: remove spec for deleted tabbedpages.py

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7492

___
Python tracker 

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



[issue33950] IDLE htest: remove spec for deleted tabbedpages.py

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7491
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



[issue30618] readlink for pathlib paths

2018-06-23 Thread girts


girts  added the comment:

Just ran into the same thing. I would be interested in adding support for a 
"readlink" call if a pull request on this would be welcome.

--
nosy: +girts

___
Python tracker 

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



[issue33950] IDLE htest: remove spec for deleted tabbedpages.py

2018-06-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 5ae70f66ff1949eec35ff207c97cfe572c4e74c8 by Terry Jan Reedy in 
branch 'master':
bpo-33950: Remove IDLE htest spec for a deleted file. (GH-7881)
https://github.com/python/cpython/commit/5ae70f66ff1949eec35ff207c97cfe572c4e74c8


--

___
Python tracker 

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



[issue33950] IDLE htest: remove spec for deleted tabbedpages.py

2018-06-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This should have been done when the replacement was made.  No news needed.

--
stage: patch review -> commit review
title: IDLE htest: don't try to test deleted tabbedpages.py -> IDLE htest: 
remove spec for deleted tabbedpages.py

___
Python tracker 

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



[issue33950] IDLE htest: don't try to test deleted tabbedpages.py

2018-06-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue33950] IDLE htest: don't try to test deleted tabbedpages.py

2018-06-23 Thread Terry J. Reedy


New submission from Terry J. Reedy :

About last September, idlelib.tabbedpages was replaced in configdialog by 
ttk.notebook and deleted.  Delete the testing spec, which causes htest to fail 
when attempting to run all htests.

--
messages: 320332
nosy: terry.reedy
priority: normal
severity: normal
stage: commit review
status: open
title: IDLE htest: don't try to test deleted tabbedpages.py
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



[issue33947] Dataclasses can raise RecursionError in __repr__

2018-06-23 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks, Raymond. I'm working on a patch.

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



[issue33933] Error message says dict has no len

2018-06-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This probably doesn't warrant another tracker entry.  Serhiy already had a PR 
for this and attached it to the original bug report for 
https://bugs.python.org/issue32500 .  See 
https://github.com/python/cpython/pull/7846

My suggestion would be to just change the error message in PySequence_Size() 
from "object of type '%.200s' has no len()" to "object of type '%.200s' has no 
len() or does not support the sequence protocol (consider using a list 
instead)".

Marking this as low priority because the behavior has existed for a very long 
time and hasn't bothered anyone until now (possibly because the bisect module 
is documented to only search lists).  Also, this is a specific instance of a 
more general, pervasive, and hard problem where low level routines raise 
exceptions that have error messages than may not make much sense from the point 
of view someone calling higher level APIs.

Suggest closing this as a duplicate and continuing the discussion back in 
issue32500 where it arose.  This would show-up in any C code that calls 
PySequence_Size() not just bisect.

--
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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



[issue33927] Allow json.tool to have identical infile and outfile

2018-06-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Maybe we should include a test that checks that if you provide an invalid file 
the file descriptors are not leaked (it can be in a different PR, maybe).

--

___
Python tracker 

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



[issue33927] Allow json.tool to have identical infile and outfile

2018-06-23 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

@Rémi can you include a NEWS entry?

Also, indicate that your patch prevents a file descriptor to be leaked in the 
cases indicated in my last message.

--

___
Python tracker 

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



[issue33927] Allow json.tool to have identical infile and outfile

2018-06-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The current status of json.tool also leaks a file descriptor if you use the 
same filename or an invalid one (needs debug build to receive this error 
message):


$ ./python -m json.tool invalid_file.dat nofile.dat
Expecting value: line 1 column 1 (char 0)
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='nofile.dat' 
mode='w' encoding='UTF-8'>

$ ./python -m json.tool valid.dat valid.dat
Expecting value: line 1 column 1 (char 0)
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='valid.dat' 
mode='w' encoding='UTF-8'>

--
nosy: +pablogsal

___
Python tracker 

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



[issue33947] Dataclasses can raise RecursionError in __repr__

2018-06-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

We have a tool designed for this problem.  See: 
https://docs.python.org/3/library/reprlib.html#reprlib.recursive_repr

If you want to avoid a dependency, it is easy to inline the logic.  For an 
example, see the Python 2.7 version of collections.OrderedDict.__repr__.

--
nosy: +rhettinger
priority: low -> normal

___
Python tracker 

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



[issue33949] tests: allow to select tests using loadTestsFromName

2018-06-23 Thread daniel hahler

New submission from daniel hahler :

I was not aware of `python -m test -m …`, but think that supporting `python -m 
test test.module.class.name` should be supported for selecting a single test.

--
components: Tests
messages: 320325
nosy: blueyed
priority: normal
pull_requests: 7489
severity: normal
status: open
title: tests: allow to select tests using loadTestsFromName
type: enhancement

___
Python tracker 

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



[issue32942] test_script_helper fails on Windows when run from the source code directory

2018-06-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Ditto with fresh update and build, except that I used installed 3.7.0rc1 (and 
it passed).  This is not regularly failing on the (Windows) buildbots, so there 
is something 'different' about the repository on some non-buildbot user 
machines.

I am pretty sure that I have run the full suite OK within the last month, 
certainly since last February.  The test has not been touched in 3 years.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue33939] Raise OverflowError in __length_hint__ for consistently infinite iterators

2018-06-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Perhaps an object can set an attribute, __infinite_iterator__ = True.

That would provide an unequivocal way to communicate to consumer code that the 
producer is known to generate a non-terminating stream.

--

___
Python tracker 

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



[issue33947] Dataclasses can raise RecursionError in __repr__

2018-06-23 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

This seems like a difficult problem to tackle in all cases, if two dataclasses 
reference each other the cycle could be complex to identify and introduce 
complexity.

The way repr is defined is part of PEP 557 and actually force this behavior.

Should the `repr` parameter default to False or not include the repr of each 
field?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue33897] Add a restart option to logging.basicConfig()

2018-06-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Raymond, what do you think about "force" from a pedagogical
> point of view?

"force" is also good.  Perhaps "clear_handlers" or "replace_handlers" would be 
more self-descriptive.

--

___
Python tracker 

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



[issue33887] doc Add TOC in Design and History FAQ

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset a845b7ab3e8ba1c20ef4c3ee23ebf50df7e7c4c6 by Miss Islington (bot) 
in branch '3.6':
bpo-33887: Add TOC to Design and History FAQ(GH-7766)
https://github.com/python/cpython/commit/a845b7ab3e8ba1c20ef4c3ee23ebf50df7e7c4c6


--

___
Python tracker 

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



[issue33887] doc Add TOC in Design and History FAQ

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset 070c91e46579429f7af7599af6d9e67a8dc5be50 by Miss Islington (bot) 
in branch '3.7':
bpo-33887: Add TOC to Design and History FAQ(GH-7766)
https://github.com/python/cpython/commit/070c91e46579429f7af7599af6d9e67a8dc5be50


--

___
Python tracker 

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



[issue33887] doc Add TOC in Design and History FAQ

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset 3e3157bd55f197ab36b280b26aea8dcd04e37fcf by Miss Islington (bot) 
in branch '2.7':
bpo-33887: Add TOC to Design and History FAQ(GH-7766)
https://github.com/python/cpython/commit/3e3157bd55f197ab36b280b26aea8dcd04e37fcf


--
nosy: +miss-islington

___
Python tracker 

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



[issue33948] doc truncated lines in PDF

2018-06-23 Thread Ned Deily


Ned Deily  added the comment:

Can you say from which URL you downloaded the PDF (assuming you didn't build it 
yourself)?

--
nosy: +ned.deily

___
Python tracker 

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



[issue33887] doc Add TOC in Design and History FAQ

2018-06-23 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

Thanks for the PR!

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



[issue33934] locale.getlocale() seems wrong when the locale is yet unset (python3 on linux)

2018-06-23 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the more detailed explanation.  I think you are right that the 
behavior does not match the documentation but which is to be preferred does not 
necessarily have an easy answer.  Also, this whole area has been undergoing 
revision, for example, with new features in 3.7.  Nick and/or Victor, can you 
address Nicolas's query?

--
nosy: +ncoghlan, vstinner

___
Python tracker 

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



[issue33887] doc Add TOC in Design and History FAQ

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7488

___
Python tracker 

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



[issue33887] doc Add TOC in Design and History FAQ

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7487

___
Python tracker 

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



[issue33887] doc Add TOC in Design and History FAQ

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7486

___
Python tracker 

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



[issue33887] doc Add TOC in Design and History FAQ

2018-06-23 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 38cf49bf695903ac7a8516bca6bbb6b32d935bb5 by Mariatta (Andrés 
Delfino) in branch 'master':
bpo-33887: Add TOC to Design and History FAQ(GH-7766)
https://github.com/python/cpython/commit/38cf49bf695903ac7a8516bca6bbb6b32d935bb5


--
nosy: +Mariatta

___
Python tracker 

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



[issue33948] doc truncated lines in PDF

2018-06-23 Thread Mikhail


New submission from Mikhail :

Hello, Python Team,

In reference.pdf I came across truncated lines in Python syntax that are not 
wrapped and carried forward to the next line, but instead run across the right 
margin.

Examples
"2.3 Identifiers and keywords" line contains "id_start ::= " expression"

It would be VERY convenient to fix this for printing.

Thank you

--
assignee: docs@python
components: Documentation
messages: 320313
nosy: Mikhail_D, docs@python
priority: normal
severity: normal
status: open
title: doc truncated lines in PDF
versions: Python 3.7

___
Python tracker 

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



[issue25862] TextIOWrapper assertion failure after read() and SEEK_CUR

2018-06-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Similar case:

text.read(1); text.write(b'x'); text.tell()

And there may be crashes after setting self->snapshot to NULL due to the 
failure of Py_BuildValue().

--

___
Python tracker 

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



[issue33946] os.symlink on Windows should use the new non-admin flag

2018-06-23 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Add non-elevated symlink support for dev mode Windows 10
type:  -> enhancement

___
Python tracker 

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



[issue33805] dataclasses: replace() give poor error message if using InitVar

2018-06-23 Thread Eric V. Smith


Change by Eric V. Smith :


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



[issue33805] dataclasses: replace() give poor error message if using InitVar

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset bbef7abe922edadc7a1679c19d6053240bf600d5 by Miss Islington (bot) 
in branch '3.7':
bpo-33805: Improve error message of dataclasses.replace() (GH-7580)
https://github.com/python/cpython/commit/bbef7abe922edadc7a1679c19d6053240bf600d5


--
nosy: +miss-islington

___
Python tracker 

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



[issue33921] Explain that '' can be used to bind to all interfaces for the AF_INET address family in the docs

2018-06-23 Thread Roundup Robot


Change by Roundup Robot :


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



[issue33942] IDLE: Problems using IDLE and 2.7, 3.6 macOS 64-/32-bit installer

2018-06-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Now I see what Ned meant by making 64-bit-only instead of 64-/32-bit the 
default in 3.6.7.

What we directly suggested is 
https://www.python.org/downloads/release/python-365/, pick 'macOS 64-bit 
installer', 'for OS X 10.9 and later'.

You could also go to https://www.python.org/downloads/mac-osx/ and pick the 
same for 3.6.6rc1 or 3.7.0rc1, or wait for 3.6.6 or 3.7.0, both of which should 
be out in a few days unless there will be an unannounced-as-yet delay.

I changed to title to something that is more likely to be useful for searches.

--
title: IDLE: Improve Apple MacOS Tcl/Tk warning and web page -> IDLE: Problems 
using IDLE and 2.7, 3.6 macOS 64-/32-bit installer

___
Python tracker 

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



[issue33805] dataclasses: replace() give poor error message if using InitVar

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7483

___
Python tracker 

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



[issue33805] dataclasses: replace() give poor error message if using InitVar

2018-06-23 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 3d70f7aef614c396f516b5fccedeebe98598714d by Eric V. Smith 
(Dong-hee Na) in branch 'master':
bpo-33805: Improve error message of dataclasses.replace() (GH-7580)
https://github.com/python/cpython/commit/3d70f7aef614c396f516b5fccedeebe98598714d


--

___
Python tracker 

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



[issue33942] IDLE: Improve Apple MacOS Tcl/Tk warning and web page

2018-06-23 Thread Jasper Trooster


Jasper Trooster  added the comment:

Hey, thanks for the quick response. I have to add that, when going to the 
download page to download site (https://www.python.org/downloads/) the big 
yellow button that says "Download Python 3.6.5" downloads the 64-/32-bit 
installer (at least, I think so as it redirects to 
https://www.python.org/ftp/python/3.6.5/python-3.6.5-macosx10.6.pkg . You can 
see the "-macosx10.6" part.) I pressed that when I started coding, not knowing 
that I had to install a different version.

You can find it when you click on Mac OS X link in the text under the button. 
Maybe the website could present an option to choose?

And one question: which installer from the list should I choose? There are 
seemingly hundreds of them.

--
Added file: https://bugs.python.org/file47649/Schermafbeelding 2018-06-23 om 
16.15.27.png

___
Python tracker 

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



[issue33671] Efficient zero-copy for shutil.copy* functions (Linux, OSX and Win)

2018-06-23 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +7482

___
Python tracker 

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



[issue33946] os.symlink on Windows should use the new non-admin flag

2018-06-23 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like Python 2.7 is inaffected by the bug:

static int
BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
{
...
#ifdef WITH_THREAD
if (!self->lock) {
self->lock = PyThread_allocate_lock();
}

if (!self->lock) {
PyErr_SetString(PyExc_MemoryError, "unable to allocate lock");
goto error;
}
#endif
...
}

I fixed the leak in Python 3.6, 3.7 and master. I close the issue.

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



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1094891b2e3eafef464819acd4cd04cfd2b59661 by Victor Stinner in 
branch '3.6':
bpo-33916: Fix bz2 and lzma init when called twice (GH-7843) (GH-7872)
https://github.com/python/cpython/commit/1094891b2e3eafef464819acd4cd04cfd2b59661


--

___
Python tracker 

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



[issue33947] Dataclasses can raise RecursionError in __repr__

2018-06-23 Thread Eric V. Smith


New submission from Eric V. Smith :

>>> @dataclass
... class C:
...   f: "C"
...
>>> c = C(None)
>>> c.f = c
>>> c
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 2, in __repr__
  File "", line 2, in __repr__
  File "", line 2, in __repr__
  [Previous line repeated 328 more times]
RecursionError: maximum recursion depth exceeded
>>>

It would be better to produce "C(f=...)".

--
components: Library (Lib)
messages: 320305
nosy: eric.smith
priority: low
severity: normal
status: open
title: Dataclasses can raise RecursionError in __repr__
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue33695] Have shutil.copytree(), copy() and copystat() use cached scandir() stat()s

2018-06-23 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

> I re-ran benchmarks since shutil code changed after #33695.

Sorry, I meant #33671.

--

___
Python tracker 

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



[issue33695] Have shutil.copytree(), copy() and copystat() use cached scandir() stat()s

2018-06-23 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

PR at: https://github.com/python/cpython/pull/7874.
I re-ran benchmarks since shutil code changed after #33695. Linux went from 
+13.5% to 8.8% and Windows went from +17% to 20.7%.
In the PR I explicitly avoided using a context manager around os.scandir() for 
now so that patch it's easier to review (will add it before pushing).

Linux (+8.8%)
=

without patch:
$ ./python  bench-copytree.py 
Priming the system's cache...
7956 files and dirs, repeat 1/3... min = 0.604s
7956 files and dirs, repeat 2/3... min = 0.603s
7956 files and dirs, repeat 3/3... min = 0.601s

with patch:
$ ./python  bench-copytree.py 
Priming the system's cache...
7956 files and dirs, repeat 1/3... min = 0.557s
7956 files and dirs, repeat 2/3... min = 0.548s
7956 files and dirs, repeat 3/3... min = 0.548s
best result = 0.548s

Windows (+20.7%)


without patch:
C:\Users\user\Desktop>cpython\PCbuild\win32\python.exe 
cpython\bench-copytree.py
Priming the system's cache...
7956 files and dirs, repeat 1/3... min = 8.275s
7956 files and dirs, repeat 2/3... min = 8.018s
7956 files and dirs, repeat 3/3... min = 7.978s
best result = 7.978s

With patch: 
C:\Users\user\Desktop>cpython\PCbuild\win32\python.exe 
cpython\bench-copytree.py
Priming the system's cache...
7956 files and dirs, repeat 1/3... min = 6.609s
7956 files and dirs, repeat 2/3... min = 6.609s
7956 files and dirs, repeat 3/3... min = 6.609s
best result = 6.609s

--

___
Python tracker 

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



[issue33695] Have shutil.copytree(), copy() and copystat() use cached scandir() stat()s

2018-06-23 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
pull_requests: +7481

___
Python tracker 

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



[issue33569] dataclasses InitVar does not maintain any type info

2018-06-23 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith

___
Python tracker 

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



[issue33927] Allow json.tool to have identical infile and outfile

2018-06-23 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi, I proposed a path in https://github.com/python/cpython/pull/7865, I'm not 
sure if I can apply the label `skip news` or if only a reviewer can.

--

___
Python tracker 

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



[issue33897] Add a restart option to logging.basicConfig()

2018-06-23 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset efc6bf66a58e96c12116d65984ac69b0f36f85de by Miss Islington (bot) 
in branch '3.7':
bpo-33916: Fix bz2 and lzma init when called twice (GH-7843)
https://github.com/python/cpython/commit/efc6bf66a58e96c12116d65984ac69b0f36f85de


--
nosy: +miss-islington

___
Python tracker 

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



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7479

___
Python tracker 

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



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7478

___
Python tracker 

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



[issue33916] test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows

2018-06-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9b7cf757213cf4d7ae1d436d86ad53f5ba362d55 by Victor Stinner in 
branch 'master':
bpo-33916: Fix bz2 and lzma init when called twice (GH-7843)
https://github.com/python/cpython/commit/9b7cf757213cf4d7ae1d436d86ad53f5ba362d55


--

___
Python tracker 

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



[issue33919] Expose _PyCoreConfig structure to Python

2018-06-23 Thread STINNER Victor


STINNER Victor  added the comment:

> We could make the hash_seed 64 bits.

On my 64-bit Linux, _Py_HashSecret_t takes 24 bytes (192 bits).

--

___
Python tracker 

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



[issue32568] Fix handling of sizehint=-1 in select.epoll()

2018-06-23 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue33934] locale.getlocale() seems wrong when the locale is yet unset (python3 on linux)

2018-06-23 Thread Nicolas Hainaux


Nicolas Hainaux  added the comment:

Sorry, I did not realize that using the word "unset" was completely misleading: 
I only meant "before any use of locale.setlocale() in python". So I'll rephrase 
this all, and add details about the python versions and platforms in this 
message.

So, first, I do not unset the environment variables from the shell before 
running python.

The only steps required to reproduce this behaviour are: open a terminal and 
run python3:

Python 3.6.5 (default, May 11 2018, 04:00:52) 
[GCC 8.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()
('fr_FR', 'UTF-8')  # Wrong: the C locale is actually in use, so (None, None) 
is expected


Explanation: when python starts, it runs using the C locale, on any platform 
(Windows, Linux, BSD), any python version (2, 3...), until locale.setlocale() 
is used to set another locale. This is expected (the doc says so in the 
getdefaultlocale() paragraph that you mentioned) and can be confirmed by the 
outputs of locale.localeconv() and locale.str().

So, before any use of locale.setlocale(), locale.getlocale() should return 
(None, None) (as this value matches the C locale).

This is the case on Windows, python2 and 3, and on Linux and FreeBSD python2.

But on Linux and FreeBSD, python>=3.4 (could not test 3.0<=python<=3.3), 
locale.getlocale() returns the value deduced from the environment variables 
instead, like locale.getdefaultlocale() already does, e.g. ('fr_FR', 'UTF-8').

All python versions I tested are from the platform distributors (3.7 only is 
compiled, but it's an automatic build from an AUR). Here is a more detailed 
list of the python versions and Linux and BSD platforms where I could observe 
this behaviour:

- Python 3.4.8, 3.5.5, 3.6.5 and 3.7.0rc1 on an up to date Manjaro (with "LTS" 
kernel): Linux 4.14.48-2-MANJARO #1 SMP PREEMPT Fri Jun 8 20:41:40 UTC 2018 
x86_64 GNU/Linux

- Python 3.6.5 on Xubuntu 18.04 (as virtual box guest) Linux 4.15.0-23-generic 
#25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

- Python 3.4.6 on openSUSE Leap 42.3 (as virtual box guest) Linux 
4.4.76-1-default #1 SMP Fri Jul 14 08:48:13 UTC 2017 (9a2885c) x86_64 x86_64 
x86_64 GNU/Linux

- Python 3.4.8 and 3.6.1 on FreeBSD 10.4-RELEASE-p8 FreeBSD 10.4-RELEASE-p8 #0: 
Tue Apr  3 18:40:50 UTC 2018 
r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

Problem of this behaviour on Linux and FreeBSD python>=3.4 is first, of course, 
that it's not consistent throughout all platforms, and second, that it makes it 
impossible for a python library to guess, from locale.getlocale() if the user 
(a python app) has set the locale or not (and is actually still using the C 
locale). (It is still possible to rely on locale.localeconv() to get correct 
elements).

Hope this message made things clear now :-)

--
versions: +Python 3.4, Python 3.5, Python 3.7

___
Python tracker 

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



[issue33939] Raise OverflowError in __length_hint__ for consistently infinite iterators

2018-06-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also a meta-issue issue29833.

If use OverflowError as a sign of infinite iterator in __length_hint__, this 
should be documented as a legitimate use case for OverflowError.

itertools.repeat.__length_hint__() and reversed.__length_hint__() currently 
raise a TypeError for infinite iterator. reversed.__length_hint__() returns 
NotImplemented (which raises a TypeError when convert to a C integer). Both 
TypeError and NotImplemented are handled by the consumer of __length_hint__: in 
PyObject_LengthHint(). An OverflowError is treated as error.

--
nosy: +serhiy.storchaka

___
Python tracker 

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