[issue31085] Add option for namedtuple to name its result type automatically

2017-08-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

[R David Murray]
> So I vote -0.5.

Put me down for a full -1:

* This would be a potentially  confusing addition to the API.

* It may also encourage bad practices that we don't want to see in real code. 

* We want to be able to search for the namedtuple definition, want to have a 
meaningful repr, and want pickling to be easy.

* This doesn't have to be shoe-horned into the namedtuple API.  If an actual 
need did arise, it is trivial to write a wrapper that specifies whatever 
auto-naming logic happens to make sense for a particular application:

>>> from collections import namedtuple
>>> def auto_namedtuple(*attrnames, **kwargs):
typename = '_'.join(attrnames)
return namedtuple(typename, attrnames, **kwargs)

>>> NT = auto_namedtuple('name', 'rank', 'serial')
>>> print(NT.__doc__)
name_rank_serial(name, rank, serial)

--

___
Python tracker 

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



[issue29902] copy breaks staticmethod

2017-08-01 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I don't think it's too important, though most py3k warnings have been
DeprecationWarning. You can think of it as deprecating a misfeature.

--

___
Python tracker 

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



[issue31100] unable to open python

2017-08-01 Thread brobby crobby

brobby crobby added the comment:

i get this message while using git bash
$ python
C:/Users/simrash2000/AppData/Local/Programs/Python/Python36/python.exe: error 
while loading shared libraries: api-ms-win-crt-heap-l1-1-0.dll: cannot open 
shared object file: No such file or directory

--
nosy: +brobby crobby

___
Python tracker 

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



[issue30841] Fix a variable shadowing warning in Python-ast.c

2017-08-01 Thread Yuan Chao Chou

Changes by Yuan Chao Chou :


--
title: A shadowing variable naming emitted for Python-ast.c -> Fix a variable 
shadowing warning in Python-ast.c

___
Python tracker 

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



[issue31100] unable to open python

2017-08-01 Thread Kenneth Griffin

New submission from Kenneth Griffin:

tried installing multiple versions of 3.6 on windows. the installation works. 
However, when trying to put python --version in the command line of powershell, 
i get a pop up that says python has stopped working.

--
components: Installation
messages: 299640
nosy: Kenneth Griffin
priority: normal
severity: normal
status: open
title: unable to open python
type: crash
versions: Python 3.6

___
Python tracker 

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



[issue30897] Add a is_mount() to pathlib

2017-08-01 Thread Łukasz Langa

Changes by Łukasz Langa :


--
pull_requests: +3022

___
Python tracker 

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



[issue31080] Allow `logging.config.fileConfig` to accept kwargs

2017-08-01 Thread Preston Landers

Changes by Preston Landers :


--
pull_requests: +3021

___
Python tracker 

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



[issue30897] Add a is_mount() to pathlib

2017-08-01 Thread Cooper Lees

Changes by Cooper Lees :


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

___
Python tracker 

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



[issue30897] Add a is_mount() to pathlib

2017-08-01 Thread Łukasz Langa

Łukasz Langa added the comment:


New changeset 173ff4a58a6b337fe8a0eb44f211f33f278d3d5f by Łukasz Langa (Cooper 
Lees) in branch 'master':
bpo-30897: Add is_mount() to pathlib.Path (#2669)
https://github.com/python/cpython/commit/173ff4a58a6b337fe8a0eb44f211f33f278d3d5f


--

___
Python tracker 

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



[issue31099] Timer error pop from empty deque/list

2017-08-01 Thread Randy Henderson

Changes by Randy Henderson :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue31099] Timer error pop from empty deque/list

2017-08-01 Thread Randy Henderson

Randy Henderson added the comment:

You're right.  I was expecting the code in stmt to be run only once, but I
just discovered in the documentation that the default is for it to be run
one million times.  I provided the argument 'number=1' to the timeit()
method and am now getting the behavior I expected.  I'll remove/close the
bug entry.  Sorry -- newbie!

On Tue, Aug 1, 2017 at 1:58 PM, R. David Murray 
wrote:

>
> R. David Murray added the comment:
>
> Perhaps I'm missing something, but isn't this to be expected?  Timer will
> run d.popleft() repeatedly until you get the error you see because the list
> is empty.  Are you thinking that setup is run each time?  That would defeat
> its purpose.
>
> --
> nosy: +r.david.murray
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue20849] add exist_ok to shutil.copytree

2017-08-01 Thread Ofek Lev

Changes by Ofek Lev :


--
pull_requests: +3020

___
Python tracker 

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



[issue31073] Change metadata handling in check command

2017-08-01 Thread Andrew Pinkham

Andrew Pinkham added the comment:

Judging from Éric's reaction on Github, I suspect there may be some reticence 
to changing this code.

I've sub-classed the check command in the project I'm working on to demonstrate 
what I would like the new behavior to be.

https://github.com/jambonsw/django-improved-user/blob/4b699814f68cefe6cf7a63f43f619ee21376cb01/setup.py#L34

If that looks interesting and people are open to changes along those lines, I'm 
happy to discuss, take feedback, and open a PR. Alternatively, I'm happy to see 
about overriding the check command in pypa/setuptools instead of modifying 
distutils. If neither of these are of interest, feel free to close this issue.

--

___
Python tracker 

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



[issue31099] Timer error pop from empty deque/list

2017-08-01 Thread R. David Murray

R. David Murray added the comment:

Perhaps I'm missing something, but isn't this to be expected?  Timer will run 
d.popleft() repeatedly until you get the error you see because the list is 
empty.  Are you thinking that setup is run each time?  That would defeat its 
purpose.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue31036] building the python docs requires the blurb module

2017-08-01 Thread Julien Palard

Julien Palard added the comment:

Still unfixed on docs.iad1.psf.io, the venv I modified is only used for sphinx 
and uses Python 2. If we can easily upgrade it to Python 3 we'll be able to 
pass it as the PYTHON parameter for make in docsbuild-script, allowing blurb to 
be found.

see: https://github.com/python/psf-salt/issues/109

--

___
Python tracker 

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



[issue31099] Timer error pop from empty deque/list

2017-08-01 Thread Randy Henderson

New submission from Randy Henderson:

Even when a deque is populated in the Timer setup parameter, the interpreter 
gives "IndexError: pop from an empty deque".  IndexError is generated for lists 
as well.

>>> Timer(stmt='d.popleft()',setup='d=deque([1,2,3])',globals=globals()).timeit()
Traceback (most recent call last):
  File "", line 1, in 
 Timer(stmt='d.popleft()',setup='d=deque([1,2,3])',globals=globals()).timeit()
  File "C:\Program Files\Python\Python36\lib\timeit.py", line 178, in timeit
timing = self.inner(it, self.timer)
  File "", line 6, in inner
IndexError: pop from an empty deque

--
components: Library (Lib)
messages: 299634
nosy: Randy Henderson
priority: normal
severity: normal
status: open
title: Timer error pop from empty deque/list
versions: Python 3.6

___
Python tracker 

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



[issue31002] IDLE: Add tests for configdialog keys tab

2017-08-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Great.  It is non-trivial, so I don't expect perfection first try.  Please 
revise docstring with explanation of how page works, like with Font and General 
pages.  I finished tests using those explanations as a guide.  They are also a 
guide for review.

--

___
Python tracker 

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



[issue31080] Allow `logging.config.fileConfig` to accept kwargs

2017-08-01 Thread Vinay Sajip

Vinay Sajip added the comment:

Yes, seems reasonable, but don't change Misc/NEWS directly in your patch - this 
is now done using the "blurb" tool. Installed into a Python 3 environment using 
"pip install blurb".

--

___
Python tracker 

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



[issue31051] IDLE, configdialog, General tab: re-arrange, test user entries

2017-08-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Given that I picked the page names without discussion, as part of quickly 
writing and merging the switch to Notebook (PR (to unblock the FontPage and 
GenPage conversion), I considered them subject to possible revision.  I expect 
to review both the internal names and the tab labels *after* adding options 
from the 'extensions'.

I have considered calling the class MainPage, as it governs the options in 
config-main other than the font, highlight, and keys choices.  (As noted 
before, the tab space setting would fit better on this page.)

Given that you have seen and used the dialog and its five tabs, is 'genpage' in 
the sequence 'fontpage, highpage, keyspage, genpage, extpage', which occurs 3 
times in create_widgets(), really ambiguous to *you*?  Or do you just not like 
it? Would you prefer MainPage?

--

___
Python tracker 

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



[issue31088] regrtest.py: "${test_file_name} skipped" message printed twice for each ${test_file_name}

2017-08-01 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

This bug in output actually occurs in sequential mode.

Apparently problem can be reproduced in 3.*, but only if 
Tools/scripts/run_tests.py is changed to run tests sequentially. (That problem 
reported as issue 31098.)

Example from 3.7:

0:00:42 load avg: 1.89 [ 11/405] test_cprofile
0:00:42 load avg: 1.89 [ 12/405] test_winsound
test_winsound skipped -- Use of the 'audio' resource not enabled
0:00:43 load avg: 1.89 [ 13/405] test_pickletools -- test_winsound skipped 
(resource denied)
0:00:46 load avg: 1.82 [ 14/405] test_select
0:00:58 load avg: 1.54 [ 15/405] test_bisect

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

___
Python tracker 

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



[issue31098] test target of Makefile always run tests in parallel mode

2017-08-01 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis:

In CPython >=3.3, "test" target of Makefile calls Tools/scripts/run_tests.py 
script.
This script contains:

def is_multiprocess_flag(arg):
return arg.startswith('-j') or arg.startswith('--multiprocess')
...
def main(regrtest_args):
...
if threading and not any(is_multiprocess_flag(arg) for arg in 
regrtest_args):
args.extend(['-j', '0'])  # Use all CPU cores


In order to run tests sequentially, in CPython 3.5 and older branches, it is 
possible to set EXTRATESTOPTS with -j1:
make test EXTRATESTOPTS="-j1"


In CPython >=3.6, this workaround no longer works, because this code 
(Lib/test/regrtest.py in 3.5):

if ns.use_mp is not None:
if ns.use_mp <= 0:
# Use all cores + extras for tests that like to sleep
ns.use_mp = 2 + (os.cpu_count() or 1)
if ns.use_mp == 1:
ns.use_mp = None

Was changed into (Lib/test/libregrtest/cmdline.py in 3.6 and 3.7):

if ns.use_mp is not None:
if ns.use_mp <= 0:
# Use all cores + extras for tests that like to sleep
ns.use_mp = 2 + (os.cpu_count() or 1)


Currently the only remaining ways to run tests sequentially are to locally edit 
Tools/scripts/run_tests.py or to not  use "test" target of Makefile and to run 
Lib/test/regrtest.py directly with appropriate options.

--
assignee: haypo
components: Tests
messages: 299629
nosy: Arfrever, haypo
priority: normal
severity: normal
status: open
title: test target of Makefile always run tests in parallel mode
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



[issue1222585] C++ compilation support for distutils

2017-08-01 Thread Josef Kemetmüller

Changes by Josef Kemetmüller :


Removed file: http://bugs.python.org/file47045/GARBAGE

___
Python tracker 

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



[issue31097] itertools.islice not accepting np.int64

2017-08-01 Thread LB

LB added the comment:

Hi Mark - I've done that here:
https://github.com/matplotlib/matplotlib/issues/8973

Liam

--

___
Python tracker 

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



[issue31085] Add option for namedtuple to name its result type automatically

2017-08-01 Thread R. David Murray

R. David Murray added the comment:

The specialized use case is wanting to autogenerate a name with no other 
information provided.  You suggested csv as one example where this would be 
used, but even in that case I'd rather see something based on the filename than 
a mashup of field names.  I would also personally rather see '_' than a long 
string of field names (it would make the debug output prettier because the 
lines would be shorter).

In contrast, being able to specify a name satisfies a wide variety of use 
cases, including that of autogenerating names with no other information 
provided.  Which is why that is included in the API.

I hear you about the rename logic.  But for myself, since I don't like the idea 
of the name being a mashup of the field names, it isn't convincing :)

I wrote a "parameterized tests" extension for unittest, and it has the option 
of autogenerating the test name from the parameter names and values.  I've 
never used that feature, and I am considering ripping it out before I release 
the package, to simplify the code.  If I do I might replace it with a hook for 
generating the test name so that the user can choose their own auto-naming 
scheme.

Perhaps that would be an option here: a hook for generating the name, that 
would be called where you want your None processing to be?  That would not be 
simpler than your proposal, but it would be more general (satisfy more use 
cases) and might be worth the cost.  On the other hand, other developers might 
not like the API bloat ;)

--

___
Python tracker 

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



[issue31084] QueueHandler not formatting messages

2017-08-01 Thread Vinay Sajip

Changes by Vinay Sajip :


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

___
Python tracker 

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



[issue31084] QueueHandler not formatting messages

2017-08-01 Thread Vinay Sajip

Vinay Sajip added the comment:


New changeset adfe3440f65dfd6cf4463db6cd02cdc78e77ce17 by Vinay Sajip (favll) 
in branch 'master':
bpo-31084: QueueHandler now formats messages correctly. (GH-2954)
https://github.com/python/cpython/commit/adfe3440f65dfd6cf4463db6cd02cdc78e77ce17


--

___
Python tracker 

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



[issue31097] itertools.islice not accepting np.int64

2017-08-01 Thread Mark Dickinson

Mark Dickinson added the comment:

That actually looks as though it may be worth a bug report to the matplotlib 
folks.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue31002] IDLE: Add tests for configdialog keys tab

2017-08-01 Thread Cheryl Sabella

New submission from Cheryl Sabella:

I'm working on the tests for this.

--
nosy: +csabella

___
Python tracker 

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



[issue31085] Add option for namedtuple to name its result type automatically

2017-08-01 Thread Isaac Morland

Isaac Morland added the comment:

First, another note I would like to point out: this is much nicer to write
within namedtuple than as a wrapper function because it is trivial to use
the existing rename logic when needed, as seen in the diff I provided. I
suppose I could write a wrapper which calls namedtuple and then changes the
class name after creation but that just feels icky. The only other
alternatives would be to duplicate the rename logic or have the wrapper not
work with rename.

By way of response to R. David Murray: Every use case, of everything, is
specialized. Another way of thinking of what I'm suggesting is that I would
like to make providing a typename optional, and have the library do its
best based on the other information provided in the call to namedtuple.
This pretty well has to mean mashing the fieldnames together in some way
because no other information about the contents of the namedtuple is
provided. So I think this is a very natural feature: what else could it
possibly mean to pass None for the typename?

If for a particular application some other more meaningful auto-generated
name is needed, that could still be provided to namedtuple(). For example,
an ORM that uses the underlying table name.

In response to other suggestions, I don't see how one can prefer "_" all
over the place in debugging output to a string that identifies the
fieldnames involved. Or really, just the option of having a string that
identifies the fieldnames: I'm not forcing anyone to stop passing '_'.

To INADA Naoki: thanks for pointing that out. I agree that in the subclass
case it no longer matters what typename is used for the namedtuple itself.
But isn't that a good reason to allow skipping the parameter, or (since you
can't just skip positional parameters) passing an explicit None?

On 1 August 2017 at 11:02, R. David Murray  wrote:

>
> R. David Murray added the comment:
>
> I think the "vaguely" pretty much says it, and you are the at least the
> first person who has *requested* it :)
>
> This is one of those cost-versus-benefit calculations.  It is a
> specialized use case, and in other specialized use cases the "automatically
> generated" name that makes the most sense is likely to be something
> different than an amalgamation of the field names.
>
> So I vote -0.5.  I don't think even the small complication of the existing
> code is worth it, but I'm not strongly opposed.
>
> --
> nosy: +r.david.murray
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue26253] tarfile in stream mode always set zlib compression level to 9

2017-08-01 Thread Yaron de Leeuw

Yaron de Leeuw added the comment:

I have submitted a PR on GitHub https://github.com/python/cpython/pull/2962

--
nosy: +jarondl
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue31089] email.utils.parseaddr fails on odd double quotes in multiline header

2017-08-01 Thread R. David Murray

R. David Murray added the comment:

Yes, that is mostly likely why parseaddr operates the way it does.  The old 
email package does not do very much hand-holding, it expects you to understand 
the RFCs, which as you note is a rather daunting task.  The new email package 
(the new policies) in python3 aim to incorporate as much understanding of the 
RFCs into the library as possible and "do the right thing" automatically so you 
don't have to worry about it (it can't hide 100%, though...).

As for universal new line mode, you are correct that technically \n by itself 
is data per the RFC (and illegal in the middle of a quoted string like that), 
but the way Python handles "text" is to convert \r\n into \n internally.  So 
while parseaddr is doing the "right thing" per the RFC, the input parsing parts 
of the email package in fact accept \n or even mixed line endings to 
accommodate the difference between unix/python line endings and RFC line 
endings.

--

___
Python tracker 

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



[issue31097] itertools.islice not accepting np.int64

2017-08-01 Thread LB

LB added the comment:

Thanks Ray. The use case is here:
https://stackoverflow.com/questions/45356718/saving-matplotlib-animation-leads-to-error/45438057#45438057

I'm going to suggest a workaround in matplotlib for the moment.  Changing type 
in this use case shouldn't be a big issue, it only happens once for each 
animation created.

--

___
Python tracker 

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



[issue31085] Add option for namedtuple to name its result type automatically

2017-08-01 Thread R. David Murray

R. David Murray added the comment:

I think the "vaguely" pretty much says it, and you are the at least the first 
person who has *requested* it :)

This is one of those cost-versus-benefit calculations.  It is a specialized use 
case, and in other specialized use cases the "automatically generated" name 
that makes the most sense is likely to be something different than an 
amalgamation of the field names.

So I vote -0.5.  I don't think even the small complication of the existing code 
is worth it, but I'm not strongly opposed.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue31097] itertools.islice not accepting np.int64

2017-08-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

See http://bugs.python.org/issue30537

--
nosy: +rhettinger

___
Python tracker 

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



[issue31097] itertools.islice not accepting np.int64

2017-08-01 Thread LB

New submission from LB:

The error arises when this code is used:
itertools.islice( [3, 4, 5], np.int64(2) )

but not with this
itertools.islice([3,4,5], 2)

--
components: Library (Lib)
messages: 299617
nosy: braaannigan
priority: normal
severity: normal
status: open
title: itertools.islice not accepting np.int64
type: crash
versions: Python 3.6

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread INADA Naoki

Changes by INADA Naoki :


--
pull_requests: +3019

___
Python tracker 

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



[issue31089] email.utils.parseaddr fails on odd double quotes in multiline header

2017-08-01 Thread Robert

Robert added the comment:

RFC regarding this topic looks quite complicated to me, but I know that \r\n is 
used for line breaking in e-mail headers and \n is not. So in my opinion it 
shouldn't be treated the same like \n. The \r\n should be removed in parsed 
text, but \n should be preserved like any other character. So I don't think 
"universal newline mode" is correct approach to read raw e-mails.

I have tested policies in python3 - you have right - it works. But I cannot use 
it because of application incompatibility with python3.

I was hoping it will be easy to fix for some more experienced than me... If not 
- you can close issue and I will stay with present solution (removing \r\n).

Thanks for all your help!

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread Alexander Mohr

Alexander Mohr added the comment:

omg I just realized I need the default dict one too, great investigation work!

--

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread INADA Naoki

INADA Naoki added the comment:

Docs/extending/newtypes.rst and Docs/include/noddy3.c should be updated too.
But I'm not good English writer.  I need help.

--

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread INADA Naoki

INADA Naoki added the comment:

> should the base method which calls tp_dealloc do this?  Maybe can kill all 
> birds with one stone.

It may be possible, but unclear.
Object finalization process is very complicated.

I agree that UnTrack object as soon as refcnt=0, and Track only when
resurrected seems clearer.
But changing such basic object system needs carefully designed by expert.

--

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread Alexander Mohr

Alexander Mohr added the comment:

actually another idea: could the PR for this also update 
https://docs.python.org/2/c-api/typeobj.html#c.PyTypeObject.tp_dealloc to 
mention about these macros and when they should be used?  That, along with all 
the other locations correctly calling these macros, and having comments when 
they're not needed hopefully should prevent this from happening again.

--

___
Python tracker 

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



[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2017-08-01 Thread Nathaniel Smith

Changes by Nathaniel Smith :


--
nosy: +njs

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread Alexander Mohr

Alexander Mohr added the comment:

I suggest any places that don't need the calls should have comments so that 
future reviewers know why.

--

___
Python tracker 

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



[issue31084] QueueHandler not formatting messages

2017-08-01 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue31096] asyncio.stream.FlowControlMixin._drain_helper may lead to a blocking behavior

2017-08-01 Thread Dmitry Malinovsky

New submission from Dmitry Malinovsky:

When there is a huge amount of `writer.write` calls followed by `await 
writer.drain()` on a non-paused channel, and there are no other coroutine 
switches, `await writer.drain()` immediately returns without a switch. This is 
because `asyncio.stream.FlowControlMixin._drain_helper` do not `yield` or 
`yield from` on a non-paused stream.

Use-case: AMQP basic.publish method, for which the broker (rabbitmq) do not 
send any replies back. Trying to publish 4k messages results in the following 
warnings (PYTHONASYNCIODEBUG env variable is set):
`Executing () created at 
/Users/malinoff/Projects/ideas/amqproto/amqproto/channel.py:85> took 2.371 
seconds`
2.371 seconds is the time spent on 4k `basic_publish` calls.

You can find the test itself on github: 
https://github.com/malinoff/amqproto/blob/master/tests/stress/test_4k_msgs.py#L11-L12

An easy fix would be to replace return 
(https://github.com/python/cpython/blob/master/Lib/asyncio/streams.py#L206) 
with yield (and but the code below under the else clause; I'm willing to 
prepare a pull request), but maybe I'm missing something and such behavior is 
intentional?

--
components: asyncio
messages: 299610
nosy: Dmitry Malinovsky, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.stream.FlowControlMixin._drain_helper may lead to a blocking 
behavior
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
type:  -> crash

___
Python tracker 

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



[issue31012] suggestion: allow termination argument in argparse to be specified as argument

2017-08-01 Thread paul j3

paul j3 added the comment:

argparse roughly follows POSIX practice:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html

Guideline 10:
The first -- argument that is not an option-argument should be 
accepted as a delimiter indicating the end of options. Any 
following arguments should be treated as operands, even if they 
begin with the '-' character.

I don't think this kind of thing is fixed, but there should be good reason to 
make an enhancement.  For many users argparse is already too complicated, and 
the docs are hard to understand.  Yet another parameter can get lost.

There are some known problems with this '--', specially when there are more 
than one.  It may also have problems when used with subparers, though I forget 
the details.

It wouldn't hard to substitute a CONST variable for this '--', and wouldn't 
require changes to the API.  

Another possibility is to change this '--' to 'parser.prefix_chars[0]*2'.  
Documenting that would be more work than implementing it.  And we'd have to add 
a unittest case.

--

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread INADA Naoki

INADA Naoki added the comment:

# _json module

scanner_dealloc()
encoder_dealloc()

# _struct module

unpackiter_dealloc

# _ssl module

context_dealloc()

# Objects/

setiter_dealloc
dictiter_dealloc
dictview_dealloc

# Parser/

ast_dealloc

--

___
Python tracker 

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



[issue29902] copy breaks staticmethod

2017-08-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Benjamin for your review!

But I have a design question. Is DeprecationWarning a correct warning type? 
DeprecationWarning is used when some feature less or more works in the current 
version, but will be removed in future releases. But pickling memoryview and 
staticmethod don't work and never worked correctly. A warning here is a sign 
that the code can not work as expected. Wouldn't RuntimeWarning be more 
appropriate warning type?

--

___
Python tracker 

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



[issue31051] IDLE, configdialog, General tab: re-arrange, test user entries

2017-08-01 Thread Louie Lu

Louie Lu added the comment:

This may relate to #31050, I would like to propose to change the name `GenTab` 
to `GeneralTab`. `GenTab` is ambiguous to `GenerateTab` in the first glimpse. 
How do you think, Terry and Cheryl ?

--

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread INADA Naoki

INADA Naoki added the comment:

> dequeiter_dealloc doesn't call Untrack(), but it's safe because it only frees 
> deque
> and deque_dealloc calls Untrack()

It may be not true, while I don't have exploit yet.

--

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-01 Thread INADA Naoki

INADA Naoki added the comment:

# collection module

dequeiter_dealloc doesn't call Untrack(), but it's safe because it only frees 
deque
and deque_dealloc calls Untrack()

dequeiter_dealloc(dequeiterobject *dio)
{
Py_XDECREF(dio->deque);


defdict_dealloc doesn't call Untrack().  And it can cause segfault:

from collections import defaultdict
import gc

class Evil:
def __del__(self):
gc.collect()
def __call__(self):
return 42

def main():
d = defaultdict(Evil())

for i in range(1000):
print(i)
main()


# _elementtree module

elementiter_dealloc() calls UnTrack(), but it seems too late?

static void
elementiter_dealloc(ElementIterObject *it)
{
Py_ssize_t i = it->parent_stack_used;
it->parent_stack_used = 0;
while (i--)
Py_XDECREF(it->parent_stack[i].parent);
PyMem_Free(it->parent_stack);

Py_XDECREF(it->sought_tag);
Py_XDECREF(it->root_element);

PyObject_GC_UnTrack(it);
PyObject_GC_Del(it);
}

--

___
Python tracker 

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



[issue25698] The copy_reg module becomes unexpectedly empty in test_cpickle

2017-08-01 Thread Soujanya. Pasam

Soujanya. Pasam added the comment:

I see test_cpickle failing with NPE while running the tests with IBM Java.

Exception Stack Trace


  
  

[issue31086] Add namedattrgetter function which acts like attrgetter but uses namedtuple

2017-08-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry Issac, but I'm going to decline this feature request.  I know you're 
enthusiastic about this or some other variation but I don't think it is worthy 
of becoming part of the standard library.  I do encourage you to post this 
somewhere as recipe (personally, I've used the ASPN cookbook to post my ideas) 
or as an offering on PyPI.

Reasons:

* The use cases are thin and likely to be uncommon.

* The recipe is short and doesn't add much value.

* The anonymous or autogenerated typename is unhelpful
  and the output doesn't look nice.

* It is already possible to combine a namedtuple with field
  extraction using a simple lambda.

* List comprehensions are clearer, easier, and more flexible
  for the task of extracting fields into a new named tuple.

* The combination of an anonymous or autogenerated typename
  along with automatic field renaming will likely cause
  more problems than it is worth.

* I don't expect this to mesh well with typing.NamedTuple
  and the needs of static typing tools

* Debugging may become more challenging with implicitly
  created named tuples that have autogenerated type names.


-- My experiments with the API --

from collections import namedtuple
from operator import attrgetter
from pprint import pprint

def namedattrgetter (attr, *attrs):
ag = attrgetter (attr, *attrs)
if attrs:
nt = namedtuple ('_', (attr,) + attrs, rename=True)
return lambda obj: nt._make (ag (obj))
else:
return ag

Person = namedtuple('Person', ['fname', 'lname', 'age', 'email'])
FullName = namedtuple('FullName', ['lname', 'fname'])

people = [
Person('tom', 'smith', 50, 'tsm...@example.com'),
Person('sue', 'henry', 40, 'she...@example.com'),
Person('hank', 'jones', 30, 'hjo...@example.com'),
Person('meg', 'davis', 20, 'mda...@example.com'),
]

# Proposed way
pprint(list(map(namedattrgetter('lname', 'fname'), people)))

# Existing way with two-steps (attrgetter followed by nt._make)
pprint(list(map(FullName._make, map(attrgetter(*FullName._fields), people

# Existing way using a lambda
pprint(list(map(lambda p: FullName(p.lname, p.fname), people)))

# Best way with a plain list comprehension
pprint([FullName(p.lname, p.fname) for p in people])

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

___
Python tracker 

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