[issue32872] backport of #32305 causes regressions in various packages

2018-03-27 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6005

___
Python tracker 

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



[issue32872] backport of #32305 causes regressions in various packages

2018-03-27 Thread Ned Deily

Ned Deily  added the comment:


New changeset e52ac045972a4f75d7f52e4ee0d6de128259134d by Ned Deily in branch 
'master':
bpo-32872: Avoid regrtest compatibility issue with namespace packages. (GH-6276)
https://github.com/python/cpython/commit/e52ac045972a4f75d7f52e4ee0d6de128259134d


--

___
Python tracker 

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



[issue32872] backport of #32305 causes regressions in various packages

2018-03-27 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6004

___
Python tracker 

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



[issue33142] Fatal Python error: Py_Initialize: Unable to get the locale encoding on Debian/Python 3.6.4 source build

2018-03-27 Thread Ned Deily

Ned Deily  added the comment:

Since python3.6 is regularly built with various Debian releases, this seems 
unlikely to be a problem in Python itself.  Suggest you verify that no venv or 
virtualenv is in use or that PYTHON* environment variables are set or that no 
modifications provided by Debian are the cause.  If you can reproduce with a 
stock Python 3.6.4 (3.6.5 shortly) tarball from python.org, please feel free to 
reopen and show the exact steps used to build, i.e. tar, configure, and make 
commands.

--
nosy: +ned.deily
resolution:  -> works for me
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



[issue32872] backport of #32305 causes regressions in various packages

2018-03-27 Thread Ned Deily

Change by Ned Deily :


--
pull_requests: +6003

___
Python tracker 

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



[issue33161] Refactor of pathlib's _WindowsBehavior.gethomedir

2018-03-27 Thread Ekin Dursun

Change by Ekin Dursun :


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

___
Python tracker 

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



[issue33161] Refactor of pathlib's _WindowsBehavior.gethomedir

2018-03-27 Thread Ekin Dursun

New submission from Ekin Dursun :

At line 245, default value for drv is provided with KeyError handling, but it 
is better to use dict's get method.

--
components: Library (Lib), Windows
messages: 314562
nosy: onlined, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Refactor of pathlib's _WindowsBehavior.gethomedir
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue24132] Direct sub-classing of pathlib.Path

2018-03-27 Thread qb-cea

qb-cea  added the comment:

Hi all,

I made a pull request proposing a fix for this issue. There is still quite a 
lot to be done:
 - I exposed some variables (and probably methods too) that used to be hidden;
 - I did not update the documentation;
 - I did not add a proper test.

I will try to fix those by the end of the week.

The patch mainly consists of two things:
 - having Path (resp. PurePath) be a variable pointing at either 
(Pure)PosixPath or (Pure)WindowsPath, depending on the platform (like Kevin 
Norris suggested);
 - introducing two new abstract classes _PurePath and ConcretePath from which 
PurePosixPath, PureWindowsPath and PosixPath, WindowsPath classes inherit;
 - removing the _Flavor classes, and redistributing their method to 
platform-specific classes.

Ideally I would like _PurePath to become a public class, but I could not come 
up with a proper name. Any feedback is more than welcome =]

--

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2018-03-27 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

It was run in i586 chroot on x86_64.

--

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2018-03-27 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

The traceback:

[builder@localhost ~]$ python -c 'x = ("a", "b") * 2**20; x *= 2**20'
Segmentation fault (core dumped)
[builder@localhost ~]$ gdb python core.23284 
GNU gdb (GDB) 7.9-alt4 (ALT)
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-alt-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...Reading symbols from 
/usr/lib/debug/usr/bin/python2.7.debug...done.
done.

warning: core file may not match specified executable file.
[New LWP 23284]
Warning: couldn't activate thread debugging using libthread_db: Cannot find new 
threads: generic error
Warning: couldn't activate thread debugging using libthread_db: Cannot find new 
threads: generic error

warning: Unable to find libthread_db matching inferior's thread library, thread 
debugging will not be available.
Warning: couldn't activate thread debugging using libthread_db: Cannot find new 
threads: generic error
Warning: couldn't activate thread debugging using libthread_db: Cannot find new 
threads: generic error

warning: Unable to find libthread_db matching inferior's thread library, thread 
debugging will not be available.
Core was generated by `python -c x = ("a", "b") * 2**20; x *= 2**20'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  tuplerepeat (a=0xf694301c, n=1048576) at Objects/tupleobject.c:503
503 *p = items[j];
(gdb) bt
#0  tuplerepeat (a=0xf694301c, n=1048576) at Objects/tupleobject.c:503
#1  0xf7546d47 in sequence_repeat (n=0x80a83ac, seq=0xf694301c, 
repeatfunc=0xf75b24a0 ) at Objects/abstract.c:1210
#2  PyNumber_InPlaceMultiply (v=0xf694301c, w=0x80a83ac) at 
Objects/abstract.c:1374
#3  0xf7602ff8 in PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:1653
#4  0xf7608fee in PyEval_EvalCodeEx (co=0xf71a8ba8, globals=0xf7240714, 
locals=0xf7240714, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, 
defcount=0, closure=0x0) at Python/ceval.c:3589
#5  0xf760916e in PyEval_EvalCode (co=0xf71a8ba8, globals=0xf7240714, 
locals=0xf7240714) at Python/ceval.c:669
#6  0xf762c508 in run_mod (arena=0x8068320, flags=0xffa1a82c, 
locals=0xf7240714, globals=0xf7240714, filename=0xf765fec9 "", 
mod=) at Python/pythonrun.c:1376
#7  PyRun_StringFlags (str=0x804b160 "x = (\"a\", \"b\") * 2**20; x *= 
2**20\n", start=257, globals=0xf7240714, locals=0xf7240714, flags=0xffa1a82c) 
at Python/pythonrun.c:1339
#8  0xf762e160 in PyRun_SimpleStringFlags (command=0x804b160 "x = (\"a\", 
\"b\") * 2**20; x *= 2**20\n", flags=0xffa1a82c) at Python/pythonrun.c:974
#9  0xf764498e in Py_Main (argc=, argv=) at 
Modules/main.c:589
#10 0x080484f7 in main (argc=3, argv=0xffa1a974) at Modules/python.c:20
(gdb) quit
[builder@localhost ~]$ 

It was built like this -- 
http://git.altlinux.org/tasks/archive/done/_188/193020/build/100/i586/log :

i586-alt-linux-gcc -pthread -c -fno-strict-aliasing -pipe -Wall -g -O3 
-march=i586 -mtune=generic -DNDEBUG -pipe -Wall -g -O3 -march=i586 
-mtune=generic  -I. -IInclude -I./Include  -fPIC -DPy_BUILD_CORE -o 
Objects/tupleobject.o Objects/tupleobject.c

The same happens with gcc7-7.3.1-alt3 here -- 
http://git.altlinux.org/tasks/202598/build/100/i586/log .

--

___
Python tracker 

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



[issue33128] PathFinder is twice on sys.meta_path

2018-03-27 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


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



[issue32850] Run gc_collect() before complaining about dangling threads

2018-03-27 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

@Victor: So to make sure I understand, the point of the check is to complain 
about reference cycles involving thread objects, because when those happen in 
the stdlib you consider them bugs?

--

___
Python tracker 

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



[issue33128] PathFinder is twice on sys.meta_path

2018-03-27 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

The same problem happens in `new_interpreter` as far as I understand.

--

___
Python tracker 

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



[issue33128] PathFinder is twice on sys.meta_path

2018-03-27 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

It seems that the problem is that `_Py_InitializeEx_Private` calls  
`_Py_InitializeCore` and `_Py_InitializeMainInterpreter`. The first one calls 
at the end `initimport` that in turns calls 
`importlib._install_external_importers` that sets the PathFinder. Then, 
`_Py_InitializeMainInterpreter` calls  `initexternalimport` that in turns calls 
again `importlib._install_external_importers` and therefore we end with two 
PathFinders in sys.meta_path.

I think the solution is removing the call to initexternalimport in 
`_Py_InitializeMainInterpreter` as it has been alreade initialized by 
`_Py_InitializeCore`.

--
nosy: +pablogsal

___
Python tracker 

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



[issue32850] Run gc_collect() before complaining about dangling threads

2018-03-27 Thread Matthias Urlichs

Matthias Urlichs  added the comment:

> It's a deliberate choice. It helped me to find real bugs. For example, I 
> found a very old reference cycle in socket.create_connection().

Fair enough; I will change the patch to complain before gc'ing.

--

___
Python tracker 

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



[issue32850] Run gc_collect() before complaining about dangling threads

2018-03-27 Thread STINNER Victor

STINNER Victor  added the comment:

> This is not useful, esp. when the list of referrers to the "dangling" thread 
> looks like this: (...)

I wrote the test.bisect tool to help to debug dangling threads issues.

Sadly, sometimes the warning can occur randomly because of race conditions, and 
it can be painful to reproduce the bug, and to fix the root issues.

--

___
Python tracker 

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



[issue32850] Run gc_collect() before complaining about dangling threads

2018-03-27 Thread STINNER Victor

STINNER Victor  added the comment:

> Lib/test/support/__init__.py::threading_cleanup() complains about dangling 
> threads even if the reference in question would be cleaned up by the garbage 
> collector.

It's a deliberate choice. It helped me to find real bugs. For example, I found 
a very old reference cycle in socket.create_connection().

The error message ("dangling threads") doesn't help, but it means that 
"something is wrong" in your test.

Sadly, sometimes you have to explicitly do something like "self.thread = None" 
in your test.

I wrote an article to explain these things:
https://vstinner.github.io/contrib-cpython-2017q3-part2.html

Instead of calling support.gc_collect(), I suggest to write documentation, 
maybe as a comment in support.threading_cleanup()?, explaining the warning and 
how to fix it. Maybe with a link to this issue? :-)

--

___
Python tracker 

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



[issue32850] Run gc_collect() before complaining about dangling threads

2018-03-27 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Yes, a PR would be better... also, the two versions of the patch appear to be 
identical?

CC'ing Antoine and Victor b/c they seem to have written this dangling_threads 
checking stuff and I'm not sure I understand it :-).

As some extra background: this is in Python's internal testing code, but 
@smurfix is hitting it because he's working on a third-party asyncio event loop 
implementation, and re-using test.asyncio to test it. I'm not sure what 
specifically is causing this to happen, though I guess it has something to do 
with how trio / trio-asyncio are using threads.

[1] https://github.com/python-trio/trio-asyncio

--
nosy: +pitrou, vstinner

___
Python tracker 

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



[issue33160] Negative values in positional access inside formatting

2018-03-27 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Should str.format allow negative indexes when used for 
__getitem__ access?

___
Python tracker 

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



[issue32517] test_read_pty_output() of test_asyncio hangs on macOS 10.13.2 (darwin 17.3.0)

2018-03-27 Thread Ned Deily

Change by Ned Deily :


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



[issue32517] test_read_pty_output() of test_asyncio hangs on macOS 10.13.2 (darwin 17.3.0)

2018-03-27 Thread Ned Deily

Ned Deily  added the comment:


New changeset 6a2539c43412567a4c693da8e7fdf5e73191fd16 by Ned Deily in branch 
'3.7':
bpo-32517: re-enable test_read_pty_output on macOS (GH-6112)
https://github.com/python/cpython/commit/6a2539c43412567a4c693da8e7fdf5e73191fd16


--

___
Python tracker 

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



[issue32517] test_read_pty_output() of test_asyncio hangs on macOS 10.13.2 (darwin 17.3.0)

2018-03-27 Thread Ned Deily

Ned Deily  added the comment:


New changeset 8534d5e4e918be82b041754ecd89af519e5b by Ned Deily in branch 
'master':
bpo-32517: fix test_read_pty_output() hangs on macOS 10.13.2+ (GH-6037) 
(GH-6113)
https://github.com/python/cpython/commit/8534d5e4e918be82b041754ecd89af519e5b


--

___
Python tracker 

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



[issue33160] Negative values in positional access inside formatting

2018-03-27 Thread Ned Deily

Change by Ned Deily :


--
nosy: +eric.smith
type:  -> enhancement
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue33160] Negative values in positional access inside formatting

2018-03-27 Thread Facundo Batista

New submission from Facundo Batista :

This works fine:

>>> "{[0]}".format([1, 2, 3])
'1'

This should work too:

>>> "{[-1]}".format([1, 2, 3])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: list indices must be integers or slices, not str

--
messages: 314549
nosy: facundobatista
priority: normal
severity: normal
status: open
title: Negative values in positional access inside formatting
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



[issue32850] Run gc_collect() before complaining about dangling threads

2018-03-27 Thread Christian Heimes

Christian Heimes  added the comment:

We generally prefer pull requests on github over patches on the bug tracker. 
Please follow the guidelines for contributing to CPython, 
https://devguide.python.org/pullrequest/

--
nosy: +christian.heimes

___
Python tracker 

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



[issue32850] Run gc_collect() before complaining about dangling threads

2018-03-27 Thread Matthias Urlichs

Matthias Urlichs  added the comment:

Apparently this patch has not been applied yet. Is there a reason for that, 
besides "it's obviously correct so there must be something wrong with it"? ;-)

--

___
Python tracker 

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



[issue33159] Implement PEP 473

2018-03-27 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue33159] Implement PEP 473

2018-03-27 Thread skreft

New submission from skreft :

Implement PEP 473.

--
messages: 314546
nosy: skreft
priority: normal
severity: normal
status: open
title: Implement PEP 473
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



[issue33155] Use super().method instead in Logging

2018-03-27 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
assignee:  -> vinay.sajip

___
Python tracker 

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



[issue25257] In subject line email library inserts unwanted space after a thousands comma in a number

2018-03-27 Thread Bob Hossley

Bob Hossley  added the comment:

Mike,

Thank you.

I moved to Python 3 some time ago.  I confirm that Python 3 does not
have the problem.  But I can't conveniently verify your workaround for
Python 2.

Regards,
Bob
bhoss...@ieee.org

On 2018-03-27 11:30 AM, Mike Edmunds wrote:
> 
> Mike Edmunds  added the comment:
> 
> Here's a workaround for Python 2.7:
> 
> ```
> class HeaderBugWorkaround(email.header.Header):
> def encode(self, splitchars=' ', **kwargs):  # only split on spaces, 
> rather than splitchars=';, '
> return email.header.Header.encode(self, splitchars, **kwargs)
> 
> # and then...
> 
> msg['Subject'] = HeaderBugWorkaround(subject, 'utf-8', header_name='Subject')
> 
> ```
> 
> (If you have the option, you're almost certainly better off moving to Python 
> 3 for anything email related. But if you're maintaining code that has to be 
> Python 2.7 compatible, this might help.)
> 
> --
> nosy: +medmunds
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue25257] In subject line email library inserts unwanted space after a thousands comma in a number

2018-03-27 Thread Mike Edmunds

Mike Edmunds  added the comment:

Here's a workaround for Python 2.7:

```
class HeaderBugWorkaround(email.header.Header):
def encode(self, splitchars=' ', **kwargs):  # only split on spaces, rather 
than splitchars=';, '
return email.header.Header.encode(self, splitchars, **kwargs)

# and then...

msg['Subject'] = HeaderBugWorkaround(subject, 'utf-8', header_name='Subject')

```

(If you have the option, you're almost certainly better off moving to Python 3 
for anything email related. But if you're maintaining code that has to be 
Python 2.7 compatible, this might help.)

--
nosy: +medmunds

___
Python tracker 

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



[issue13829] exception error in _scproxy.so when called after fork

2018-03-27 Thread triccare triccare

triccare triccare  added the comment:

I have run into this bug which can be reliably reproduced by importing tkinter.

However, I have found another workaround if one does not want to deal with the 
environmental variable and may point to a possible bug fix. Before forking, any 
use of `urlopen` alleviates the bug. This is demonstrated in the attached 
example.

Example works under Python 3.6.4 and Mac OS 10.12.6

--
nosy: +triccare triccare
Added file: https://bugs.python.org/file47503/debug_urlopen.py

___
Python tracker 

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



[issue33151] importlib.resources breaks on subdirectories

2018-03-27 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


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



[issue33151] importlib.resources breaks on subdirectories

2018-03-27 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:


New changeset fd1b8f87b3e63495cadd37c8f1b90191b46ee52a by Barry Warsaw (Miss 
Islington (bot)) in branch '3.7':
bpo-33151: Handle submodule resources (GH-6268) (GH-6270)
https://github.com/python/cpython/commit/fd1b8f87b3e63495cadd37c8f1b90191b46ee52a


--

___
Python tracker 

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



[issue33158] Add fileobj property to csv reader and writer objects

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> A fileobj property would be convenient, as you otherwise, for example, need 
> to pass an extra argument to routines that need both the csv object and the 
> underlying file object.

But you should already have this object for creating csv.reader() or 
csv.writer().

Even if keep the argument of the constructor as an instance attribute, there is 
a problem with naming this attribute. csv.reader works not only with files. It 
accepts arbitrary iterable.

>>> it = iter(['Spam, Spam, Spam, Spam, Spam, Baked Beans', 'Spam, Lovely Spam, 
>>> Wonderful Spam'])
>>> list(csv.reader(it))
[['Spam', ' Spam', ' Spam', ' Spam', ' Spam', ' Baked Beans'], ['Spam', ' 
Lovely Spam', ' Wonderful Spam']]

The dialect property is not a copy of the dialect constructer argument.

--
nosy: +serhiy.storchaka
versions:  -Python 2.7

___
Python tracker 

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



[issue33155] Use super().method instead in Logging

2018-03-27 Thread Mads Jensen

Change by Mads Jensen :


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

___
Python tracker 

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



[issue33151] importlib.resources breaks on subdirectories

2018-03-27 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5998

___
Python tracker 

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



[issue33151] importlib.resources breaks on subdirectories

2018-03-27 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:


New changeset 30e507dff465a31901d87df791a2bac40dc88530 by Barry Warsaw in 
branch 'master':
bpo-33151: Handle submodule resources (GH-6268)
https://github.com/python/cpython/commit/30e507dff465a31901d87df791a2bac40dc88530


--

___
Python tracker 

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



[issue32742] zipfile extractall needlessly re-wraps ZipInfo instances

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

There is an obscure behavior change introduced by this PR. Technically a ZIP 
file can contain several entries with the same name. Currently extractall() 
will extract the last of them multiple times.  The result doesn't differ from 
when extract it only once, there is just a waste of time. After merging this PR 
extractall() will extract different entries to the same location. If one of the 
is a directory, and other is a file, extractall() will fail.

I'm not sure it can be considered a valid ZIP file, but currently the zipfile 
module supports it.

On other hand, what is the benefit of using `self.infolist()` instead of 
`self.namelist()`?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33158] Add fileobj property to csv reader and writer objects

2018-03-27 Thread Samwyse

New submission from Samwyse :

Many objects have properties that allow access to the arguments used to create 
them.  In particular, file objects have a name property that returns the name 
used when opening a file.  A fileobj property would be convenient, as you 
otherwise, for example, need to pass an extra argument to routines that need 
both the csv object and the underlying file object.  Adopting this enhancement 
would also provide consistency with the dialect constructer argument, which is 
available as an object property.

Changing the fileobj while the csv object is in use would open a can of worms, 
so this should be a read-only property.

Optionally, the fileobj property could be reflected in the DictReader and 
DictWriter classes, but the value would be accessible via the .reader and 
.writer properties of those classes.

--
components: Library (Lib)
messages: 314538
nosy: samwyse
priority: normal
severity: normal
status: open
title: Add fileobj property to csv reader and writer objects
type: enhancement
versions: Python 2.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



[issue33144] random._randbelow optimization

2018-03-27 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

Thanks, Raymond. I'll do that once I've addressed Serhiy's points.

--

___
Python tracker 

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



[issue33144] random._randbelow optimization

2018-03-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Wolfgang, can you submit this as a PR.

--

___
Python tracker 

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



[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Marked as closed for the reasons listed.

Thank you for the suggestion, but we're going to decline.

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



[issue33144] random._randbelow optimization

2018-03-27 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

Serhiy:

> I like the idea in general, but have comments about the implementation.
> 
> __init_subclass__ should take **kwargs and pass it to 
> super().__init_subclass__(). type(cls.random) is not the same as 
> type(self.random). I would use the condition `cls.random is 
> _random.Random.random` instead, or check if the method is in cls.__dict__.
> 
> This will break the case when random or getrandbits methods are patched after 
> class creation or per instance, but I think we have no need to support this.
> 

My bad, sorry, and thanks for catching all these issues!

You're absolutely right about the class type checks not being equivalent 
to the original ones at the instance level.
Actually, this is due to the fact that I first moved the checks out of 
_randbelow and into __init__ just as Raymond would have done and tested 
this, but then I realized that __init_subclass__ looked just like the 
right place and moved them again - this time without testing on derived 
classes again.
 From a quick experiment it looks like types.MethodDescriptorType would 
be the correct type to check cls.random against and types.FunctionType 
would need to be checked against cls.getrandbits, but that starts to 
look rather esoteric to me - so you are probably right that something 
with a cls.__dict__ check or the alternative suggestion of `cls.random 
is _random.Random.random` are better solutions, indeed.

> We could support also the following cases:
> 
> 1.
>  class Rand1(Random):
>  def random(self): ...
>  # _randbelow should use random()
> 
>  class Rand2(Rand1):
>  def getrandbits(self): ...
>  # _randbelow should use getrandbits()
>  # this is broken in the current patch
> 

Right, hadn't thought of this situation.

> 2.
>  class Rand1(Random):
>  def getrandbits(self): ...
>  # _randbelow should use getrandbits()
> 
>  class Rand2(Rand1):
>  def random(self): ...
>  # _randbelow should use random()
>  # this is broken in the current code
> 

May be worth fixing, too.

--

___
Python tracker 

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



[issue33157] Strings beginning with underscore not removed from lists - feature or bug?

2018-03-27 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

In addition to Xiang Zhang's comments, this is neither a feature nor a bug, but 
a misunderstanding. This has nothing to do with strings or underscores:

py> L = [1, 2, 3, 4, 5]
py> for item in L:
... L.remove(item)
...
py> L
[2, 4]


When you modify a list as you iterate over it, the results can be unexpected. 
Don't do it.

If you *must* modify a list that you are iterating over, you must do so 
backwards, so that you are only removing items from the end, not the beginning 
of the list:

py> L = [1, 2, 3, 4, 5]
py> for i in range(len(L)-1, -1, -1):
... L.remove(L[i])
...
py> L
[]


But don't do that: it is nearly always must faster to make a copy of the list 
containing only the items you wish to keep, then assign back to the list using 
slicing. A list comprehension makes this an easy one-liner:

py> L = [1, 2, 3, 4, 5]
py> L[:] = [x for x in L if x > 4]
py> L
[5]

--
nosy: +steven.daprano

___
Python tracker 

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



[issue33157] Strings beginning with underscore not removed from lists - feature or bug?

2018-03-27 Thread Xiang Zhang

Xiang Zhang  added the comment:

You may refer to stackoverflow for an explanation, for example, 
https://stackoverflow.com/questions/6260089/strange-result-when-removing-item-from-a-list

--

___
Python tracker 

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



[issue33157] Strings beginning with underscore not removed from lists - feature or bug?

2018-03-27 Thread Xiang Zhang

Xiang Zhang  added the comment:

It's just the right behavior. You are modifying the list while iterating over 
it. It has no business of underscore.

>>> test = ['_a', 'a', '_b', 'b']
>>> for i in test: test.remove(i)
>>> test
['a', 'b']

--
nosy: +xiang.zhang
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



[issue33157] Strings beginning with underscore not removed from lists - feature or bug?

2018-03-27 Thread yemiteliyadu

New submission from yemiteliyadu :

Strings beginning with underscore not removed from lists
Reproducible as shown below:

Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 12:04:33) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test = ["a","_a","b","_b"]
>>> for i in test: print(i)
... 
a
_a
b
_b
>>> for i in test: test.remove(i)
... 
>>> test
['_a', '_b']
>>> 

Is this a feature or a bug?
A search through the docs did not show any mention of this.

--
messages: 314530
nosy: yemiteliyadu
priority: normal
severity: normal
status: open
title: Strings beginning with underscore not removed from lists - feature or 
bug?
type: behavior
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



[issue33152] Use list comprehension in timeit module instead of loop with append

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

We usually do not do such kind of changes due to the risk of introducing new 
bugs (as your PR demonstrated). Only when other changes are applied to the 
module, the surrounded code can be cleaned up. Or the maintainer of the module 
can do this if he decided that it is a time for modernization.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33152] Use list comprehension in timeit module instead of loop with append

2018-03-27 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


--
title: clean code -> Use list comprehension in timeit module instead of loop 
with append

___
Python tracker 

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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-03-27 Thread Ethan Welty

Ethan Welty  added the comment:

@ronaldoussoren: The order of the imports made no difference. Even with the 
call at the top, I got endless errors with both 'spawn' and 'forkserver', with 
or without importing a graphics backend. Only 'fork' works, and only if a 
graphics package is not imported.

** HOWEVER **

Setting method='spawn' or 'forkserver' and force=True at top, or calling 
multiprocessing.set_start_method in __main__ does work (when run as scripts 
from command line). It's a shame to have to give up the convenience of 'fork', 
but this is a start.

```
import multiprocessing
multiprocessing.set_start_method("spawn", force=True)
import numpy as np
# import _tkinter

def parallel_matmul(x):
R = np.random.randn(3, 3)
return np.matmul(R, x)

if __name__ == '__main__':
# multiprocessing.set_start_method("spawn", force=False)
pool = multiprocessing.Pool(4)
results = pool.map(parallel_matmul, [np.random.randn(3, 5000) for i in 
range(2)])
```

--

___
Python tracker 

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



[issue33149] Parser stack overflows

2018-03-27 Thread Ned Deily

Change by Ned Deily :


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



[issue32861] urllib.robotparser: incomplete __str__ methods

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The default entry was moved out of entries added in issue523041, but 
RobotFileParser.__str__ was not updated. Support for "Crawl-delay" and 
"Request-Rate" was added in issue16099, but Entry.__str__ was not updated. This 
looks like bugs to me, and I think the fix should be backported.

But two unnecessary trailing newlines should be kept for compatibility in 
maintained versions. I think we can get rid of them in 3.8 (unless Senthil has 
other opinion).

--
nosy: +serhiy.storchaka
versions: +Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue33156] Use super().method instead in email classes.

2018-03-27 Thread R. David Murray

R. David Murray  added the comment:

Thank you for wanting to improve Python, but unless this is actually causing a 
problem for someone, there is a greater chance of introducing a bug by making 
such changes than the benefit of the "cleanup".  So we generally don't accept 
such patches.  If we modify the code for other reasons (ie: we might already be 
introducing new bugs), then we make such changes.

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



[issue33014] Clarify str.isidentifier docstring; fix keyword.iskeyword docstring

2018-03-27 Thread R. David Murray

R. David Murray  added the comment:

I think my wording would be an improvement to the docs as well.  You could link 
just the keyword function if you are worried about too many links, since that 
would keep the link count the same.

--

___
Python tracker 

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



[issue33146] contextlib.suppress should capture exception for inspection and filter on substrings

2018-03-27 Thread Nick Coghlan

Nick Coghlan  added the comment:

I wouldn't expand the scope of contextlib.suppress, since it has a pretty clear 
purpose: pretend the exception never happened. (This was even clearer with the 
original "ignored" name, before I was talked into changing it to use the 
current more technically correct, but far less intuitive, name - a decision I 
still regret).

However, when writing tests, or otherwise introspecting thrown exceptions (i.e. 
in programs about programs), it's not uncommon for me to want a construct like:

with catch(FileNotFoundError) as err:
os.remove(somefile)

if err.caught is not None:
...

The benefit over the try/catch form is similar to the benefits of suppress:

1. Up front declaration that that kind of exception isn't going to escape and 
execution will continue after the suite
2. More efficient use of vertical whitespace (one extra line instead of three)

In this case, we could also end up expanding the API to provide a better 
building block for testing tools like "assertRaises" and "assertRaisesRegex" by 
accepting a "filter" callback argument that receives the caught exception, and 
can either return False to suppress it, True to reraise it, or explicitly raise 
a different exception to replace it. (That suggested callback API is 
deliberately similar to an __exit__ implementation that only accepts the 
exception value, rather than the full type/value/traceback triple).

(The simpler name may mean that folks end up preferring catch() to suppress() 
even when they don't need the result of __enter__. I'd be OK with that outcome).

--

___
Python tracker 

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



[issue32569] Blake2 module, memory clearance update

2018-03-27 Thread David CARLIER

David CARLIER  added the comment:

Little update it has been accepted and merged today :

https://github.com/BLAKE2/libb2/commit/620681a3b15c4d7239b9323b9da5ea208a959d3d

--
nosy: +David CARLIER2

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

tuplerepeat() in Objects/tupleobject.c uses a questionable check that relies on 
signed integer overflow. It is a matter of time when this rifle will shoot in 
the foot. But I didn't expected issues with old good gcc 6.3. Was the 
interpreter compiled with non-standard options or ran on non-x86 platform?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33156] Use super().method instead in email classes.

2018-03-27 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
type:  -> enhancement

___
Python tracker 

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



[issue33155] Use super().method instead in Logging

2018-03-27 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +vinay.sajip
type:  -> enhancement
versions: +Python 3.8

___
Python tracker 

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



[issue31853] Use super().method instead of socket.method in SSLSocket

2018-03-27 Thread Christian Heimes

Christian Heimes  added the comment:

I agree

Also this ticket was closed a couple of months ago and is about the SSL module. 
Your PR is about a different module. Although I think that recycling is 
generally a good idea, it doesn't apply to ticket numbers.

--
components: +SSL -email

___
Python tracker 

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



[issue31853] Use super().method instead of socket.method in SSLSocket

2018-03-27 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

The only time this should matter semantically is if someone is trying to 
subclass SSLSocket and use multiple inheritance. This is something that people 
*really* shouldn't do.

It also potentially makes it harder to backport ssl changes to 2.7.

I'm not really seeing the advantages here...

--
nosy: +njs

___
Python tracker 

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



[issue33156] Use super().method instead in email classes.

2018-03-27 Thread Mads Jensen

New submission from Mads Jensen :

There are lots of legacy calls in the form of ClassName.method, which should be 
replaced with super().method.

--
components: email
messages: 314519
nosy: barry, madsjensen, r.david.murray
priority: normal
pull_requests: 5997
severity: normal
status: open
title: Use super().method instead in email classes.
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue31853] Use super().method instead of socket.method in SSLSocket

2018-03-27 Thread INADA Naoki

INADA Naoki  added the comment:

Why *should*?

Legacy ParentClass.method() call is faster than super().method() call, because 
there are no temporary proxy object.

I don't think there are enough reason to replace all legacy parent calls.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue33155] Use super().method instead in Logging

2018-03-27 Thread Mads Jensen

New submission from Mads Jensen :

There are lots of legacy calls in the form of ClassName.method, which should be 
replaced with super().method. This is an issue in many modules; I've been asked 
to create a report for each module that the PR touches.

--
components: Library (Lib)
messages: 314517
nosy: madsjensen
priority: normal
severity: normal
status: open
title: Use super().method instead in Logging

___
Python tracker 

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



[issue31853] Use super().method instead of socket.method in SSLSocket

2018-03-27 Thread Mads Jensen

Mads Jensen  added the comment:

There are lots of legacy calls in the form of ClassName.method, which should be 
replaced with super().method.

--
components: +email -SSL
nosy: +barry, r.david.murray
pull_requests: +5996

___
Python tracker 

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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-03-27 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

@ezwelty: The import of multiprocessing and the call to set_start_method should 
be at the very start of the code, before other imports, to avoid the annoying 
Apple behavior I mentioned.

--

___
Python tracker 

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



[issue16482] pdb.set_trace() clobbering traceback on error

2018-03-27 Thread daniel hahler

daniel hahler  added the comment:

Just for reference: https://github.com/python/cpython/pull/6233 is about fixing 
this.

--
keywords: +patch
nosy: +blueyed
pull_requests: +5995
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



[issue33154] subprocess.Popen ResourceWarning should have activation-deactivation flags

2018-03-27 Thread Arno-Can Uestuensoez

Arno-Can Uestuensoez  added the comment:

See also 
issue26741 - subprocess.Popen should emit a ResourceWarning in destructor if ...

--

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2018-03-27 Thread INADA Naoki

INADA Naoki  added the comment:

Would you paste traceback?

--
nosy: +inada.naoki

___
Python tracker 

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



[issue33154] subprocess.Popen ResourceWarning should have activation-deactivation flags

2018-03-27 Thread Arno-Can Uestuensoez

New submission from Arno-Can Uestuensoez :

The subprocess call *subprocess.Popen* in Python3.6 was added a number of 
resource warnings, including subprocess run-state and open files. This is a 
very good facility for debugging, but causes a lot of trouble for programs 
relying on subprocesses via the STDIO/STDERR interface. The STDIO/STDERR 
interfaces are very common when shell utilities are incorporated into high 
level Python programs.

The other issue is the unit testing of command line tools as black-box tests, 
these solely rely on the STDOUT and STDERR interface. I am currently finishing 
a subprocess test package with common code for Python2.7 and Python3.5+, so 
facing some trouble with IO filtering. Examples are attached.

A system call should process the common IO interfaces of the called 
subprocesses by default without any additional output. So a call flag and/or an 
environment variable should be introduced in addition, which allows the 
activation and deactivation of these messages.
The default should be *deactive*.

--
components: Library (Lib)
files: python3-output.txt
messages: 314511
nosy: acue, martin.panter, pitrou, python-dev, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: subprocess.Popen ResourceWarning should have activation-deactivation 
flags
type: resource usage
versions: Python 3.6
Added file: https://bugs.python.org/file47502/python3-output.txt

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2018-03-27 Thread Ivan Zakharyaschev

New submission from Ivan Zakharyaschev :

The issue https://bugs.python.org/msg314475 has arisen for tuples (but not for 
lists, as in the example there) in 2.7.14 for me. How should we fix it in a 
better way?

This bug is not reproducible in python 3.5.4.

[builder@localhost ~]$ python
Python 2.7.14 (default, Nov  7 2017, 17:07:17) 
[GCC 6.3.1 20170118 (ALT 6.3.1-alt2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [0] * 2**20
>>> x *= 2**20
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>> x = [0,0,0,0,0,0] * 2**20
>>> x *= 2**20
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>> x = ('a', 'b')
>>> x = ('a', 'b') * 2**20
>>> x *= 2**20
Segmentation fault
[builder@localhost ~]$ python --version
Python 2.7.14
[builder@localhost ~]$ python
Python 2.7.14 (default, Nov  7 2017, 17:07:17) 
[GCC 6.3.1 20170118 (ALT 6.3.1-alt2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxsize
2147483647
>>> sys.maxint
2147483647
>>> 
[builder@localhost ~]$ python RPM/BUILD/Python-2.7.14/Lib/test/test_tuple.py
test_addmul (__main__.TupleTest) ... ok
test_bigrepeat (__main__.TupleTest) ... Segmentation fault
[builder@localhost ~]$

--
components: Interpreter Core
messages: 314508
nosy: imz
priority: normal
severity: normal
status: open
title: interpreter crash when multiplying large tuples
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue1704621] interpreter crash when multiplying large lists

2018-03-27 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

New issue filed: https://bugs.python.org/issue33153

--

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2018-03-27 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

I meant the old issue https://bugs.python.org/issue1704621 .

--

___
Python tracker 

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



[issue33014] Clarify str.isidentifier docstring; fix keyword.iskeyword docstring

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I concur with David about the docstring. But I think that no changes are needed 
in the module documentation. David's wording would contain two links (for 
iskeyword() and for keyword), and many links distract the attention.

We already spent for this issue more time than it deserves.

--

___
Python tracker 

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



[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

If the reason of this change was making the error message more consistent with 
other error messages in classic classes (at the cost of larger dereference with 
Python 3), it LGTM.

--

___
Python tracker 

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



[issue33124] Lazy execution of module bytecode

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Function definitions usually are cheap, as well as global constants definitions 
(unless they use complex comprehensions or call heavy functions for 
initialization). Creating a class is an order or more slower than creating a 
function. Creating enums and namedtuples is an order or two slower than 
creating a plain class.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33152] clean code

2018-03-27 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue33152] clean code

2018-03-27 Thread Windson Yang

New submission from Windson Yang :

https://github.com/python/cpython/blob/master/Lib/timeit.py#L202

use a list comprehension instead

--
components: Distutils
messages: 314504
nosy: Windson Yang, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: clean code
type: behavior
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



[issue33146] contextlib.suppress should capture exception for inspection and filter on substrings

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'm not sure that contextlib.suppress() should be added at first place.

try:
os.remove(somefile)
except FileNotFoundError:
pass

is a tiny bit longer, but is more explicit, doesn't depend on the other module, 
works in all Python versions that have this exception, and is easily extensible.

try:
os.remove(somefile)
except FileNotFoundError as e:
# what do you want to do with e?
pass

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33150] Signature error for methods of class configparser.Interpolation

2018-03-27 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue33144] random._randbelow optimization

2018-03-27 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I think this is excellent application of __init_subclass__. It is common to 
patch an instance method in __init__, but this can create a reference loop if 
patch it by other instance method. In this case the choice doesn't depend on 
arguments of __init__, and can be done at class creation time.

I like the idea in general, but have comments about the implementation.

__init_subclass__ should take **kwargs and pass it to 
super().__init_subclass__(). type(cls.random) is not the same as 
type(self.random). I would use the condition `cls.random is 
_random.Random.random` instead, or check if the method is in cls.__dict__.

This will break the case when random or getrandbits methods are patched after 
class creation or per instance, but I think we have no need to support this.

We could support also the following cases:

1.
class Rand1(Random):
def random(self): ...
# _randbelow should use random()

class Rand2(Rand1):
def getrandbits(self): ...
# _randbelow should use getrandbits()
# this is broken in the current patch

2.
class Rand1(Random):
def getrandbits(self): ...
# _randbelow should use getrandbits()

class Rand2(Rand1):
def random(self): ...
# _randbelow should use random()
# this is broken in the current code

--

___
Python tracker 

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