[issue30010] Initial bytes to BytesIO cannot be seeked to

2017-04-07 Thread Samuli G

New submission from Samuli G:

The initial bytes provided for the BytesIO constructor are lost when the stream 
is written to.

Seeking to offset zero, and then getting the value of the entire buffer results 
of getting only the bytes that have been appended by calling "write".

--
components: IO
files: bytesio_bug.py
messages: 291254
nosy: Samuli G
priority: normal
severity: normal
status: open
title: Initial bytes to BytesIO cannot be seeked to
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file46784/bytesio_bug.py

___
Python tracker 

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



[issue30010] Initial bytes to BytesIO cannot be seeked to

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is expected behavior. When you write to ByitesIO you overwrites the old 
content.

If you want to append to ByitesIO, first move the position to the end: 
b.seek(0, io.SEEK_END).

--
nosy: +serhiy.storchaka
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



[issue30011] HTMLParser class is not thread safe

2017-04-07 Thread Alessandro Vesely

New submission from Alessandro Vesely:

SYMPTOM:
When used in a multithreaded program, instances of a class derived from 
HTMLParser may convert an entity or leave it alone, in an apparently random 
fashion.

CAUSE:
The class has a static attribute, entitydefs, which, on first use, is 
initialized from None to a dictionary of entity definitions.  Initialization is 
not atomic.  Therefore, instances in concurrent threads assume that 
initialization is complete and catch a KeyError if the entity at hand hasn't 
been set yet.  In that case, the entity is left alone as if it were invalid.

WORKAROUND:
class Dummy(HTMLParser):
"""this class is defined here so that we can initialize its base 
class"""
def __init__(self):
HTMLParser.__init__(self)

# Initialize HTMLParser by loading htmlentitydefs
dummy = Dummy()
dummy.feed('')
del dummy, Dummy

--
components: Library (Lib)
messages: 291256
nosy: ale2017
priority: normal
severity: normal
status: open
title: HTMLParser class is not thread safe
type: behavior
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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1182

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If don't make PySlice_GetIndicesEx a macro when Py_LIMITED_API is not defined, 
it should be expanded to PySlice_Unpack and PySlice_AdjustIndices. PR 1023 does 
this for master branch. The patch is generated by Coccinelle's semantic patch.

--
Added file: http://bugs.python.org/file46786/PySlice_GetIndicesEx.cocci

___
Python tracker 

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



[issue30011] HTMLParser class is not thread safe

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +easy
nosy: +ezio.melotti

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Peter

New submission from Peter:

Under Python 2, gzip.open defaults to giving (non-unicode) strings.

Under Python 3, gzip.open defaults to giving bytes. Therefore it was fixed to 
allow text mode be specified, see http://bugs.python.org/issue13989

In order to write Python 2 and 3 compatible code to get strings from gzip, I 
now use:

>>> import gzip
>>> handle = gzip.open(filename, "rt")

In general mode="rt" works great, but I just found this fails under Windows XP 
running Python 2.7, example below using the following gzipped plain text file:

https://github.com/biopython/biopython/blob/master/Doc/examples/ls_orchid.gbk.gz

This works perfectly on Linux giving strings on both Python 2 and 3 - not I am 
printing with repr to confirm we have a string object:

$ python2.7 -c "import gzip; print(repr(gzip.open('ls_orchid.gbk.gz', 
'rt').readline())); import sys; print(sys.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
2.7.10 (default, Sep 28 2015, 13:58:31) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]

Also with a slightly newer Python 2.7,

$ /mnt/apps/python/2.7/bin/python  -c "import gzip; 
print(repr(gzip.open('ls_orchid.gbk.gz', 'rt').readline())); import sys; 
print(sys.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
2.7.13 (default, Mar  9 2017, 15:07:48) 
[GCC 4.9.2 20150212 (Red Hat 4.9.2-6)]

$ python3.5 -c "import gzip; print(repr(gzip.open('ls_orchid.gbk.gz', 
'rt').readline())); import sys; print(sys.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
3.5.0 (default, Sep 28 2015, 11:25:31) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]

$ python3.4 -c "import gzip; print(repr(gzip.open('ls_orchid.gbk.gz', 
'rt').readline())); import sys; print(sys.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
3.4.3 (default, Aug 21 2015, 11:12:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]

$ python3.3 -c "import gzip; print(repr(gzip.open('ls_orchid.gbk.gz', 
'rt').readline())); import sys; print(sys.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
3.3.0 (default, Nov  7 2012, 21:52:39) 
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]


This works perfectly on macOS giving strings on both Python 2 and 3:


$ python2.7 -c "import gzip; print(repr(gzip.open('ls_orchid.gbk.gz', 
'rt').readline())); import sys; print(sys.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
2.7.10 (default, Jul 30 2016, 19:40:32) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]

$ python3.6 -c "import gzip; print(repr(gzip.open('ls_orchid.gbk.gz', 
'rt').readline())); import sys; print(sys.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]


This works perfectly on Python 3 running on Windows XP,


C:\repositories\biopython\Doc\examples>c:\Python33\python.exe -c "import gzip; 
print(repr(gzip.open('ls_orchid.gbk.gz', 'rt').readline()\
)); import sys; print(sys.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:37:12) [MSC v.1600 32 bit (Intel)]

C:\repositories\biopython\Doc\examples> C:\Python34\python.exe -c "import gzip; 
print(repr(gzip.open('ls_orchid.gbk.gz', 'rt').readline(\
))); import sys; print(sy
s.version)"
'LOCUS   Z78533   740 bpDNA linear   PLN 
30-NOV-2006\n'
3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)]



However, it fails on Windows XP running Python 2.7.11 and (after upgrading) 
Python 2.7.13 though:


C:\repositories\biopython\Doc\examples>c:\Python27\python -c "import sys; 
print(sys.version); import gzip; print(repr(gzip.open('ls_orch\
id.gbk.gz', 'rt').readlines()))"
2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)]

Traceback (most recent call last):
  File "", line 1, in 
  File "c:\Python27\lib\gzip.py", line 34, in open
return GzipFile(filename, mode, compresslevel)
  File "c:\Python27\lib\gzip.py", line 94, in __init__
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
ValueError: Invalid mode ('rtb')


Note that the strangely contradictory mode seems to be accepted by Python 2.7 
under Linux or macOS:


$ python
Python 2.7.10 (default, Sep 28 2015, 13:58:31) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gzip
>>> gzip.open('ls_orchid.gbk.gz', 'rt')

>>> quit()


$ python2.7
Python 2.7.10 (default, Jul 30 2016, 19:40:32) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gzip
>>> gzip.open('ls_orchid.gbk.gz', 'rt')

>>> quit()


[issue30013] Compiling warning in Modules/posixmodule.c

2017-04-07 Thread Louie Lu

New submission from Louie Lu:

Using gcc-6.3.1 20170306 on Linux 4.10.1, it gave the warning:

gcc -pthread -c -Wno-unused-result -Wsign-compare -g -Og -Wall 
-Wstrict-prototypes-std=c99 -Wextra -Wno-unused-result 
-Wno-unused-parameter -Wno-missing-field-initializers 
-Werror=implicit-function-declaration   -I. -I./Include-DPy_BUILD_CORE -o 
Python/pyctype.o Python/pyctype.c
:./Modules/posixmodule.c: In function ‘os_major_impl’:
./Modules/posixmodule.c:8584:13: warning: In the GNU C Library, "major" is 
defined
 by . For historical compatibility, it is
 currently defined by  as well, but we plan to
 remove this soon. To use "major", include 
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including .
 return major(device);
 ^  



 
./Modules/posixmodule.c: In function ‘os_minor_impl’:
./Modules/posixmodule.c:8601:13: warning: In the GNU C Library, "minor" is 
defined
 by . For historical compatibility, it is
 currently defined by  as well, but we plan to
 remove this soon. To use "minor", include 
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including .
 return minor(device);
 ^  



 
./Modules/posixmodule.c: In function ‘os_makedev_impl’:
./Modules/posixmodule.c:8619:13: warning: In the GNU C Library, "makedev" is 
defined
 by . For historical compatibility, it is
 currently defined by  as well, but we plan to
 remove this soon. To use "makedev", include 
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including .
 return makedev(major, minor);
 ^  


The problem introduce in glibc 2.25, going to deprecate the definition of 
'major', 'minor', and 'makedev' by  sys/types.h. And the autoconf didn't change 
the behavior of `AC_HEADER_MAJOR`, see:

https://lists.gnu.org/archive/html/autoconf/2016-08/msg00014.html


There is a workaround path for this in libvirt, which take from autoconf patch, 
see:

https://www.redhat.com/archives/libvir-list/2016-September/msg00459.html

--
components: Extension Modules
messages: 291260
nosy: louielu
priority: normal
severity: normal
status: open
title: Compiling warning in Modules/posixmodule.c
type: compile error
versions: Python 3.7

___
Python tracker 

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



[issue30013] Compiler warning in Modules/posixmodule.c

2017-04-07 Thread Louie Lu

Changes by Louie Lu :


--
title: Compiling warning in Modules/posixmodule.c -> Compiler warning in 
Modules/posixmodule.c

___
Python tracker 

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



[issue30013] Compiler warning in Modules/posixmodule.c

2017-04-07 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +1184

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-04-07 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1185

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola':

Patch in attachment modifies DefaultSelector.modify() so that it uses the 
underlying selector's modify() method instead of unregister() and register() 
resulting in a 2x speedup.

Without patch:
~/svn/cpython {master}$ ./python bench.py 
0.006010770797729492

With patch:
~/svn/cpython {master}$ ./python bench.py 
0.00330352783203125

--
files: selectors_modify.diff
keywords: patch
messages: 291261
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: Speedup DefaultSelectors.modify() by 2x
Added file: http://bugs.python.org/file46787/selectors_modify.diff

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
versions: +Python 3.7
Added file: http://bugs.python.org/file46788/bench.py

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +gvanrossum, haypo, neologix, yselivanov

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
components: +Library (Lib), asyncio
stage:  -> patch review
type:  -> performance

___
Python tracker 

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



[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread 林建佑

New submission from 林建佑:

Windows also treats full-width spaces as a delimiter when parsing command line 
arguments.

Therefore, subprocess.run() and subprocess.Popen() also need to quote the arg 
in the sequence of arguments if there is any full-width spaces in it.

Example:

>> subprocess.run(['foo', 'half-width space', 'full-width space'])

should be executed as 
>> foo "half-width space" "full-width space"
Windows will treat it as 3 arguments

but now it is incorrectly executed as 
>> foo "half-width space" full-width space
Windows will treat it as 4 arguments

--
components: Library (Lib), Windows
messages: 291262
nosy: paul.moore, steve.dower, tim.golden, zach.ware, 林建佑
priority: normal
severity: normal
status: open
title: Windows also treats full-width spaces as a delimiter when parsing 
arguments
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1186

___
Python tracker 

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



[issue30016] No sideways scrolling in IDLE

2017-04-07 Thread Jensen Taylor

New submission from Jensen Taylor:

This has been a bug since 2.7 as far as I know.

--
assignee: terry.reedy
components: IDLE
messages: 291263
nosy: Jensen Taylor, terry.reedy
priority: normal
severity: normal
status: open
title: No sideways scrolling in IDLE
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Charles-François Natali

Charles-François Natali added the comment:

Hm, do you have a realistic benchmark which would show the benefit?
Because this is really a micro-benchmark, and I'm not convinced that
Selector.modify() is a significant bottleneck in a real-world
application.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

modify() can be used often in verbose protocols such as FTP and SMTP where a 
lot of requests and responses are continuously exchanged between client and 
server, so you need to switch from EVENT_READ to EVENT_WRITE all the time. I 
did a similar change some years ago in pyftpdlib but I don't have another 
benchmark other than this one.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

Hi Giampaolo Rodola'! It seems like you proposed the same idea 4 years ago and 
I wrote a similar patch: issue #18932 :-)

I suggest you to use my perf module to produce more reliable benchmarks. Here 
is my results on my computer smithers tuned for benchmarks:

haypo@smithers$ ./python bench_selectors.py -o ref.json
[apply the patch]
haypo@smithers$ ./python bench_selectors.py -o patch.json
haypo@smithers$ ./python -m perf compare_to ref.json patch.json  --table
+--+-+--+
| Benchmark| ref | patch|
+==+=+==+
| PollSelector.modify  | 11.3 us | 8.22 us: 1.37x faster (-27%) |
+--+-+--+
| EpollSelector.modify | 13.5 us | 8.88 us: 1.52x faster (-34%) |
+--+-+--+

Not significant (1): SelectSelector.modify


@neologix: "Hm, do you have a realistic benchmark which would show the benefit?"

I don't think that selector.modify() can be a bottleneck, but IMHO the change 
is simple and safe enough to be worth it. In a network server with 10k client, 
an optimization making .modify() 1.52x faster is welcomed.

--
Added file: http://bugs.python.org/file46789/bench_selectors_modify.py

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

@Giampaolo Rodola: CPython development moved to GitHub, can you please create a 
pull request instead of a patch? Thank you.
https://docs.python.org/devguide/pullrequest.html

Hum, I see that my old patch of issue #18932 
(selectors_optimize_modify-2.patch) is different. I tried to factorize code. 
What do you think of my change?

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Hey Stinner, thanks for chiming in! Your old patch uses unregister() and 
register() so I'm not sure what speedup that'll take as the whole point is to 
avoid doing that. You may want to rewrite it and benchmark it but it looks like 
it'll be slower.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

PR: https://github.com/python/cpython/pull/1030

--
pull_requests: +1187

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

@neologix: Do you have a GitHub account? It's hard to me to see if 
https://github.com/neologix is you or not, and your GitHub username is not 
filled in the Bug Tracker database.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

Giampaolo Rodola': "Your old patch uses unregister() and register() so I'm not 
sure what speedup that'll take as the whole point is to avoid doing that."

My patch calls generic unregister() and register() of the base classes, but it 
only uses one syscall per modify() call.

Oh by the way, it seems like my patch changes KqueueSelector, but your change 
doesn't. Am I right? KqueueSelector is the default selector on FreeBSD and 
macOS. IMHO it's worth it to optimize it as well.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Speedup DefaultSelectors.modify() by 2x -> Speedup 
DefaultSelectors.modify() by 1.5x

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

> My patch calls generic unregister() and register() of the base
> classes, but it only uses one syscall per modify() call.

Doesn't that mean doing 3 operations (unregister(), register(), modify()) 
instead of the current 2 (unregister(), register())? I don't see how it can be 
faster than a single modify() syscall.

> Oh by the way, it seems like my patch changes KqueueSelector, 
> but your change doesn't. Am I right?

You are right but it looks like you end up doing the same thing as unregister() 
and register(). kqueue() has no modify() method so I don't think it can benefit 
from this change.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

> Doesn't that mean doing 3 operations (unregister(), register(), modify()) 
> instead of the current 2 (unregister(), register())? I don't see how it can 
> be faster than a single modify() syscall.

The idea is to reuse _BaseSelectorImpl.register() and 
_BaseSelectorImpl.unregister() to factorize the code. These methods don't use 
syscall, they create the SelectorKey object and update _fd_to_key. So each 
class doesn't have to redo these things.

I don't insist to redo what I did, I'm just trying to explain my change because 
your change basically copy/paste the same code 3 times, and you forgot 
KqueueSelector, so you even may have to copy it a 4th time ;-)

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

> The idea is to reuse _BaseSelectorImpl.register() and
> _BaseSelectorImpl.unregister() to factorize the code.

You can't factorize the logic of modify() into those as they do two different 
things. I also don't like repeating the same thing 3 times but given how the 
module is organized I'm not sure how to do that as I need to pass 3 things 
around: the low-level selector (epoll, poll, whatever) and the read and write 
constants (POLLIN, EPOLLIN) which change depending on the selector being used.
The same thing applies to the devpoll class (http://bugs.python.org/issue18931).
I can write a second patch which to refactor the whole module if that is 
desirable but I prefer to do that in another PR.

--

___
Python tracker 

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



[issue27585] asyncio.Lock deadlock after cancellation

2017-04-07 Thread Mathieu Sornay

Changes by Mathieu Sornay :


--
pull_requests: +1188

___
Python tracker 

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



[issue30017] zlib

2017-04-07 Thread Jeremy Heiner

New submission from Jeremy Heiner:

I had some statements inside a `with` statement to write data to an entry in a
ZipFile. It worked great. I added a second `with` statement containing almost
exactly the same statements. That still worked great.

I refactored those common statements into a function and called that function
from the two `with` statements... and got an exception:

  zlib.error: Error -2 while flushing: inconsistent stream state

I can't figure out why it matters whether the writing happens in the `with` or
in the function called by the `with`, but here's a trimmed-down version of the
code that demonstrates the problem:


#!/usr/bin/env python

import io, pprint, zipfile
from zipfile import ZIP_DEFLATED

def printLiteral( data, out ) :
encoder = io.TextIOWrapper( out, encoding='utf-8', write_through=True )
pprint.pprint( data, stream=encoder )

data = { 'not' : 'much', 'just' : 'some K \N{RIGHTWARDS WHITE ARROW} V pairs' }

with zipfile.ZipFile( 'zzz.zip', mode='w', compression=ZIP_DEFLATED ) as myzip :

with myzip.open( 'this one works', 'w' ) as out :
encoder = io.TextIOWrapper( out, encoding='utf-8', write_through=True )
pprint.pprint( data, stream=encoder )

with myzip.open( 'this one fails', 'w' ) as out :
printLiteral( data, out )

print( 'printed but entry still open' )
print( 'entry has been closed but not file' )
print( 'zip file has been closed' )


And here's the output on my Arch Linux 64bit with package `python 3.6.0-2`...
A co-worker sees the same behavior on MacOS 10.11.6 Python 3.6.1 :


printed but entry still open
Traceback (most recent call last):
  File "zzz.py", line 21, in 
print( 'printed but entry still open' )
  File "/usr/lib/python3.6/zipfile.py", line 995, in close
buf = self._compressor.flush()
zlib.error: Error -2 while flushing: inconsistent stream state


I tried debugging this in PyDev but got lost. Turning off the compression makes
the exception go away.

--
messages: 291275
nosy: Jeremy Heiner
priority: normal
severity: normal
status: open
title: zlib
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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Jeremy Heiner

Changes by Jeremy Heiner :


--
title: zlib -> zlib.error: Error -2 while flushing: inconsistent stream state

___
Python tracker 

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



[issue29914] Incorrect signatures of object.__reduce__() and object.__reduce_ex__()

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue29838] Check that sq_length and mq_length return non-negative result

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue29839] Avoid raising OverflowError in len() when __len__() returns negative large value

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue29958] Use add_mutually_exclusive_group(required=True) in zipfile and tarfile CLI

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 150cd1916a59e750ce88c65325de9ef0c42c6cb5 by Serhiy Storchaka in 
branch 'master':
bpo-29958: Minor improvements to zipfile and tarfile CLI. (#944)
https://github.com/python/cpython/commit/150cd1916a59e750ce88c65325de9ef0c42c6cb5


--

___
Python tracker 

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



[issue29958] Use add_mutually_exclusive_group(required=True) in zipfile and tarfile CLI

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread Eryk Sun

Eryk Sun added the comment:

> Windows also treats full-width spaces as a delimiter when parsing 
> command line arguments.

CreateProcess has to parse the beginning of the command-line string if the 
lpApplicationName parameter is omitted. According to the documentation, it 
treats "white space" as a delimiter, but it doesn't actually say which 
characters are in that set. We know for an unquoted name like 
"python{character}spam" that it will try to execute python.exe if "{character}" 
is parsed as a space. Otherwise we expect CreateProcess to fail with 
ERROR_FILE_NOT_FOUND because it's looking for the non-existent file 
"python{character}spam". Here's a test that checks all characters that Unicode 
considers to be whitespace, which includes "ideographic space" (U+3000):

import os
import sys
import subprocess

space_chars = [chr(c) for c in range(sys.maxunicode) if chr(c).isspace()]
assert '\N{IDEOGRAPHIC SPACE}' in space_chars # U+3000

def get_create_delims():
assert not os.path.exists('spam')
filename = 'python{}spam'
basepath = os.path.dirname(sys.executable)
delims = []
for space in space_chars:
path = os.path.join(basepath, filename.format(space))
assert not os.path.exists(path)
try:
subprocess.check_output(path, stderr=subprocess.STDOUT)
except FileNotFoundError:
pass # not a delimiter
except subprocess.CalledProcessError:
delims.append(space)
else:
assert False, 'python.exe should have failed'
return delims


>>> get_create_delims()
['\t', ' ']

CreateProcess considers only space and horizontal tab as white-space 
delimiters, at least on this Windows 10 system.

Otherwise Windows itself doesn't care about the command line. It's up to each 
application to parse its command line however it wants. subprocess.list2cmdline 
assumes an application uses argv from Microsoft's C runtime. The Windows shell 
function CommandLineToArgvW is supposed to follow the same rules. The following 
calls CommandLineToArgvW on a test command-line string for each character in 
the space_chars set:

import ctypes
from ctypes import wintypes

shell32 = ctypes.WinDLL('shell32', use_last_error=True) 

PLPWSTR = ctypes.POINTER(wintypes.LPWSTR)
shell32.CommandLineToArgvW.restype = PLPWSTR

def cmdline2argv(cmdline):
argc = ctypes.c_int()
pargv = shell32.CommandLineToArgvW(cmdline, ctypes.byref(argc))
if not pargv:
raise ctypes.WinError(ctypes.get_last_error())
return pargv[:argc.value]

def get_argv_delims():
cmdline = 'test{}space'
delims = []
for space in space_chars:
if len(cmdline2argv(cmdline.format(space))) > 1:
delims.append(space)
return delims


>>> get_argv_delims()
['\t', '\n', '\x0b', '\x0c', '\r', '\x1c', '\x1d', '\x1e', '\x1f', ' ']

In addition to space and horizontal tab, CommandLineToArgvW also considers line 
feed, vertical tab, form feed, carriage return, file separator, group 
separator, record separator, and unit separator to be white-space delimiters. 
This disagrees with [1], which says it should be limited to space and 
horizontal tab, like CreateProcess. Let's test this as well:

def get_msvc_argv_delims():
template = '"{}" -c "import sys;print(len(sys.argv))" test{}space'
delims = []
for space in space_chars:
cmdline = template.format(sys.executable, space)
out = subprocess.check_output(cmdline)
argc = int(out)
if argc > 2:
delims.append(space)
return delims


>>> get_msvc_argv_delims()
['\t', ' ']

Apparently CommandLineToArgvW is inconsistent with the C runtime in this case.

On my Windows 10 system, ideographic space (U+3000) is not generally a 
command-line delimiter. That's not to say that some applications (and maybe 
localized CRTs?) don't use it that way. But I don't think it's the place of the 
subprocess module to handle it.

[1]: https://msdn.microsoft.com/en-us/library/17w5ykft

--
nosy: +eryksun

___
Python tracker 

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



[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Charles McEachern

New submission from Charles McEachern:

I'm calling the constructor of Foo, a subclass of str. Expected output:

Called Foo.__new__ with args = ('TIMESTAMP', 'INPUT0')
TIMESTAMP OUTPUT0

When I make the call using a multiprocessing.pool.ThreadPool, it works fine. 
But when I make the call using a multiprocessing.Pool (using the apply or 
apply_async method), I get:

Called Foo.__new__ with args = ('TIMESTAMP', 'INPUT0')
Called Foo.__new__ with args = ('TIMESTAMP OUTPUT0',)
Exception in thread Thread-3:
...
ValueError: Bad Foo input: ('TIMESTAMP OUTPUT0',)

That is, the object I just constructed seems to be getting shoved right back 
into the constructor. 

When I swap out the Foo class for the similar Goo class, which is not a str, 
and uses __init__ instead of __new__, I again see no problems:

Called Goo.__init__ with args = ('TIMESTAMP', 'INPUT0')


I see this in 2.7.9 as well as 3.4.5. Looks like it's present in 2.7.2 and 
3.5.2 as well:

https://github.com/charles-uno/python-new-pool-bug/issues/1

--
components: Library (Lib)
files: newpool.py
messages: 291278
nosy: Charles McEachern
priority: normal
severity: normal
status: open
title: multiprocessing.Pool garbles call stack for __new__
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file46790/newpool.py

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread R. David Murray

R. David Murray added the comment:

I don't think this is really a bug, I think it's a consequence of the different 
byte/string models of python2 and python3 coupled with the different 
binary/text models of posix and windows.

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Charles-François Natali

Charles-François Natali added the comment:

> I don't think that selector.modify() can be a bottleneck, but IMHO the change 
> is simple and safe enough to be worth it. In a network server with 10k 
> client, an optimization making .modify() 1.52x faster is welcomed.

IMHO it complicates the code for little benefit: that's why I asked
for a realistic benchmark. This patch could made modify() 10x faster,
if modify() only accounts for 1% of the overall overhead in a
realistic use-case, then it's not worth it.

--
title: Speedup DefaultSelectors.modify() by 1.5x -> Speedup 
DefaultSelectors.modify() by 2x

___
Python tracker 

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



[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread LCY

LCY added the comment:

Thank you for testing and explanation.

My test cases are not enough.

I will close this issue.

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



[issue29974] Change typing.TYPE_CHECKING doc example

2017-04-07 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

In certain protocols modify() is supposed to be used on every interaction 
between client and server. E.g. an FTP server does this:

- register(fd, EVENT_READ); recv() # wait command from client
- modify(fd, EVENT_WRITE); send(response)  # send response
- modify(fd, EVENT_READ); recv()   # wait for new command

...so it's two calls for each command received.
In asyncio modify() is also used in different circumstances. 
If you're worried about code duplication I can refactor selectors.py first, but 
IMO it would be a bad idea to reject this or future improvements because the 
current code status prevents code reuse. Right now there are already 3 classes 
sharing basically the same code (poll, epoll and devpoll related classes). 
Those can be refactored similarly to this:
https://github.com/giampaolo/pyftpdlib/blob/ab699b5f89223e03593f3e004d6a370b4c2e5308/pyftpdlib/ioloop.py#L465-L565

--

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Eryk Sun

Eryk Sun added the comment:

In Python 3, gzip.open(filename, "rt") returns a TextIOWrapper using the 
system's default encoding. The decoded output is potentially very different 
from the byte string returned by 'text mode' in Python 2, even if using "rt" 
mode didn't result in the nonsensical "rtb" mode. I suggest using the default 
binary mode, and manually wrapping the file in an io.TextIOWrapper.

--
nosy: +eryksun

___
Python tracker 

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



[issue29071] IDLE doesn't highlight f-strings properly

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

#29287 is about syntax highlighting the code within f-strings as code rather 
than as part of the string.

--

___
Python tracker 

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



[issue23984] Documentation error: Descriptors

2017-04-07 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1189

___
Python tracker 

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



[issue29956] math.exp documentation is misleading

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Is math.exp(x) always more accurate than math.e ** x?  If so, doc could say so. 
 Otherwise, should this be closed?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

@neologix: here's a PR which refactors the poll-related classes: 
https://github.com/python/cpython/pull/1035/files
>From there, we'll be able to avoid modify() code duplication.

--

___
Python tracker 

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



[issue29975] Issue in extending documentation

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I agree with the rejection on the PR.

--
nosy: +terry.reedy
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue29976] urllib.parse clarify what ' ' in schemes mean

2017-04-07 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
pull_requests: +1190

___
Python tracker 

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



[issue29980] OSError: multiple exceptions should preserve the exception type if it is common

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I agree.  And if the sub-exceptions are different, prepend them to the messages 
in the OSError list.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue30019] IDLE got unexpexted bahavior when trying to use some characters

2017-04-07 Thread David E. Franco G.

New submission from David E. Franco G.:

wandering for the internet I fount some unicode character in a random comment, 
and just for curiosity I wanted to use python (3.6.1) to see their value, so I 
copy those characters and paste them in IDLE, and in doing so it just close 
without warning or explanation.

the character in question are: 🔫 🔪
(chr(128299) and chr(128298))

then I put them in a script 

text = "🔫 🔪"
print(text)

and try to load it but instead it open a new empty scrip, again without 
apparent reason, which for some reason I can't close, I needed to kill the 
process for that.

I try the same with the IDLE in python 2.7.13 for the first one I got

Unsupported characters in input

which at least is something, and changing the script a little

# -*- coding: utf-8 -*-
text = u"🔫 🔪"
print(text)

it work without problem and print correctly. 

Also opening the script in interactive mode (python -i myscript.py) it work as 
expected and I get their numbers (that I put above).

So why is that? and please fix it.

--
assignee: terry.reedy
components: IDLE
messages: 291289
nosy: David E. Franco G., terry.reedy
priority: normal
severity: normal
status: open
title: IDLE got unexpexted bahavior when trying to use some characters
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



[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A generator function *gf* is a function that contain *yield* in its body.  When 
it is compiled, flag CO_GENERATOR is set in gf.__code__.co_flags.  When the 
function is called, the flag is queried and if set, a special path is taken 
that attaches the live but suspended code instance to a generator instance.

*isgeneratorfunction* tests that an object is a function and that the flag is 
set.

return bool((isfunction(object) or ismethod(object)) and
object.__code__.co_flags & CO_GENERATOR)

This is exactly what it should do.

Any function could potentially call a generator function and return its result. 
 Martin's *test2*, with or without the wrapper, is an example.

Note that *iscoroutinefunction* and *isaynchgenfunction* follow the same 
pattern, but with different flags.  A 4th flag is queried by *isawaitable*. The 
return object of any of these could also by returned by other functions.

--
nosy: +terry.reedy
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
type:  -> enhancement
versions: +Python 3.7 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

If you want to know if a function returns a generator, you have to call it and 
pass the result to *isgenerator*, or use type-annotated functions (see the 
typing module) and static type checkers.

--

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Davin Potts

Davin Potts added the comment:

It looks like the first 'Called Foo.__new__' is being reported by the child 
(pool of 1) process and the second 'Called Foo.__new__' is being reported by 
the parent process.  In multiprocessing, because objects are by default 
serialized using pickle, this may be caused by the unpickling of the Foo object 
by the parent process which is something you would not experience when using 
ThreadPool because it does not have the same need for serialization.

Example showing invocation of __new__ as part of unpickling:
>>> class Foo(object):
... def __new__(cls):
... print("New")
... return object.__new__(cls)
... 
>>> import pickle
>>> f = Foo()
New
>>> pf = pickle.dumps(f, protocol=2)
>>> pickle.loads(pf)  # unpickling triggers __new__
New
<__main__.Foo object at 0x1084a06d0>



Having discovered this phenomenon, is this causing a problem for you somewhere 
in code?  (Your example code on github was helpful, thank you, but it didn't 
merely demonstrated the behavior and didn't show where this was causing you 
pain.)

--
nosy: +davin

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Peter

Peter added the comment:

I want a simple cross platform (Linux/Mac/Windows) and cross version (Python 
2/3) way to be able to open a gzipped file and get a string handle (default 
encoding TextIOWrapper under Python 3 is fine). My use-case is specifically for 
documentation examples.

Previously I used gzip.open(filename) but with the introduction of Python 3 
that stopped working because the Python 3 default was to give you bytes.

Thanks to http://bugs.python.org/issue13989 switching to  gzip.open(filename, 
"rt") almost covered my use case, leaving Python 2 windows as the odd one out.

I propose that under Python 2.7, gzip.open explicit accept but ignore "t" as 
part of the mode argument in order to allow cross-platform code to work nicely.

i.e. Formalise the observed Python 2.7 behaviour under Linux and Mac which 
ignore the "t", and change Windows so that it ignores the "t" as well.

--

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Davin Potts

Davin Potts added the comment:

Expanding my above example to show how multiprocessing relates:
>>> import multiprocessing
>>> import os
>>> class Floof(object):
... def __new__(cls):
... print("New via pid=%d" % os.getpid())
... return object.__new__(cls)
... 
>>> os.getpid()   # parent pid
46560
>>> pool = multiprocessing.Pool(1)
>>> getter = pool.apply_async(Floof, (), {})  # output seen from child AND 
>>> parent
>>> New via pid=46583
New via pid=46560

>>> getter.get()  # everything seems to be working 
>>> as intended
<__main__.Floof object at 0x10866f250>


FWIW, near the end of my prior message:  s/it didn't merely/it merely/

--

___
Python tracker 

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



[issue28643] Broken makefile depends for profile-opt target

2017-04-07 Thread Douglas Greiman

Changes by Douglas Greiman :


--
nosy: +dgreiman

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Charles McEachern

Charles McEachern added the comment:

This caused me several hours of misery yesterday, trying to isolate what was 
going wrong. 

I am unfortunately not at liberty to share the code I'm working on. The example 
on GitHub has the general thrust of it: my constructor was always called in a 
specific way, and didn't expect to be given something that was already 
processed. 

Interesting to see that this is a product of pickling. That makes me think that 
"fixing" this corner case would probably be a lot of work.

I suppose I should just work around it by checking right away if the input to 
my constructor has already been constructed!

--

___
Python tracker 

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



[issue29989] subprocess.Popen does not handle file-like objects without file descriptors

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

'crash' means OS message rather than Python exiting with exception traceback 
and message.

Can you post a minimal reproducer?  What OS?  subprocess.Popen._get_handles is 
different on POSIX and windows, though both seem to call f.fileno() without 
try-except. 

All filenoes are initialized to -1, so it seems to me that either
a. all accesses should be wrapped with try-except: pass, or
b. subprocess doc should say that file-like objects must include a fileno 
method returning -1.

I am puzzled though.  The 2.7 doc for (builtin)file.fileno() says 
"
Note
File-like objects which do not have a real file descriptor should not provide 
this method! "
"
Rather than return -1

In must be that the subprocess test does not test with a 'file-like object 
without a file descriptor'

--
nosy: +terry.reedy
type: crash -> behavior

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Davin Potts

Davin Potts added the comment:

> I am unfortunately not at liberty to share the code I'm working on.

I very much understand and am very thankful you took the time to create a 
simple example that you could share.  Honestly, that's the reason I felt 
inspired to stop what I was doing to look at this now rather than later.


> I suppose I should just work around it by checking right away if the input to 
> my constructor has already been constructed!

There are probably a number of different ways to address it but your suggestion 
of adding a check to see if this is the first time that object has been 
constructed sounds like it might be an easy win.

--

___
Python tracker 

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



[issue30003] Remove hz codec

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

We seldom just remove things; we usually deprecate in the doc and if possible, 
issue a runtime warning.

This is probably not the only obsolete codec.  There should be a uniform policy 
for deprecation and removal, if ever.  But for any codec, there might be 
archives, even if the codec is not used for new files.

If the codec is buggy, I think it should be fixed. Bt you yourself closed 
#24117, suggesting that you did not believe that the patches should be applied.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue30008] OpenSSL 1.1.0 deprecated functions

2017-04-07 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +alex, christian.heimes, dstufft, janssen

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread R. David Murray

R. David Murray added the comment:

I suspect you just need to add pickle support to your class.  When I subclassed 
str in the email package, I found I needed to do that.  I'd have to go through 
the docs again to remember how the code works, but you can take a look at the 
BaseHeader class in email.headerregistry to see what I did.

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Eryk Sun

Eryk Sun added the comment:

You want to hack a fake text mode, which won't do new-line translation or treat 
^Z (0x1a) as EOF like a normal 2.x text mode on Windows. Can't you just use 
io.TextIOWrapper(gzip.open(filename))? This reads Unicode.

--

___
Python tracker 

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



[issue29939] Compiler warning in _ctypes_test.c

2017-04-07 Thread Vinay Sajip

Changes by Vinay Sajip :


--
pull_requests: +1191

___
Python tracker 

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



[issue29939] Compiler warning in _ctypes_test.c

2017-04-07 Thread Vinay Sajip

Changes by Vinay Sajip :


--
pull_requests: +1192

___
Python tracker 

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



[issue1207613] Idle Editor: Bottom Scroll Bar

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I don't like telling people to hand-edit .idlerc files. It causes too many 
problems.  We added Extensions tab to avoid this.  I think all supported 
options should be on dialog.

Windows are resizable and accommodate lines up to current width.  Default width 
is user settable option.  So people who want to edit 100 char lines for code 
can and have editor open with 100 char width.

Shell,Edit, and Output windows should not necessarily be same.  Currently, 
Shell wraps both input and output while Editor Output truncate code input and 
grep output respectively.  I plan to review this, including possible scrollbar, 
but not a priority.

--
assignee:  -> terry.reedy

___
Python tracker 

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



[issue23894] lib2to3 doesn't recognize rb'...' and f'...' in Python 3.6

2017-04-07 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Charles McEachern

Charles McEachern added the comment:

That seems to do it! Looks like the trick is to define __reduce__ to help out 
the serializer. Thanks!

--

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Peter

Peter added the comment:

A workaround for my use case is even simpler, something like this:

try:
handle = gzip.open(filename, "rt")
except ValueError:
# Workaround for Python 2.7 under Windows
handle = gzip.open(filename, "r")

However, even this is troublesome for use in documentation intended to work on 
Python 2 and 3, over Linux, Mac and Windows.

--

___
Python tracker 

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



[issue29939] Compiler warning in _ctypes_test.c

2017-04-07 Thread Vinay Sajip

Vinay Sajip added the comment:


New changeset d0d575a6db8cb3b2a720be9f404af3d754da9a5d by Vinay Sajip in branch 
'3.6':
bpo-29939: suppress compiler warnings in _ctypes_test (#1038)
https://github.com/python/cpython/commit/d0d575a6db8cb3b2a720be9f404af3d754da9a5d


--

___
Python tracker 

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



[issue29939] Compiler warning in _ctypes_test.c

2017-04-07 Thread Vinay Sajip

Vinay Sajip added the comment:


New changeset ae0915e42d8cd96e5ced1fc442ea078b4a59e82d by Vinay Sajip in branch 
'3.5':
Closes bpo-29939: suppress compiler warnings in _ctypes_test (#1039)
https://github.com/python/cpython/commit/ae0915e42d8cd96e5ced1fc442ea078b4a59e82d


--
status: open -> closed

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Charles-François Natali

Charles-François Natali added the comment:

This refactoring was already suggested a long time ago, and at the
time both Guido and I didn't like it because it makes the code
actually more complicated: DRY in this case doesn't apply IMO.

Also, this whole thread is a repeat of:
http://bugs.python.org/issue18932

At the time, I already asked for one realistic use case demonstrating
the benefit of implementing modify() natively instead of
unregister()+register().
I know that this code makes modify() faster, but as I said multiple
times, I'd like to se the impact on something else than a
micro-benchmark: arguably if you propose this it's because you've
profiled/found it to be an actual bottleneck, do you have *one*
benchmark to support this change?

--

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Martin Panter

Martin Panter added the comment:

I agree this is not a bug. It is just one of the unfortunate compatibility 
breaks between Py 2 and 3. Mode="rt" is not one of the values that are 
supported according to the documentation; adding support would be a new feature.

I understand the file mode handling is stricter on Windows because the 
underlying OS or C library would crash.

To have code that works with Py 2 and 3, I would switch the mode depending on 
the version of Python:

if sys.version_info >= (3,):
handle = gzip.open(filename, "rt")
else:
handle = gzip.open(filename)

--
nosy: +martin.panter
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



[issue29989] subprocess.Popen does not handle file-like objects without file descriptors

2017-04-07 Thread Martin Panter

Martin Panter added the comment:

Raphael: Can you point to the implementation code that handles file objects 
without a file descriptor (or give a demonstration of it)? I suspect there is 
no such support and you are mistaken.

Perhaps we can instead clarify in the “subprocess” documentation that “fileno” 
is required. Issue 19992 already proposes this.

Issue 1260171 and Issue 10482 are also related, about streaming data between 
Python file objects in the parent and pipes connected to the child.

--
nosy: +martin.panter
stage:  -> test needed
superseder:  -> subprocess documentation not explicit about fileno()

___
Python tracker 

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



[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Ellison Marks

Ellison Marks added the comment:

At a guess, when encoder goes out of scope, it closes the underlying file 
object. Then, on exiting the with block, the zipfile tries to take some action 
with the closed file and errors out?

--
nosy: +Ellison Marks

___
Python tracker 

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



[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Martin Panter

Martin Panter added the comment:

It looks like the zip entry writer object may not expect its “close” method to 
be called multiple times. Other file objects tend to allow this with no ill 
effect. Adding Serhiy and Thomas who implemented the writer object in Issue 
26039.

The first time it is called will be when the context manager (“with” statement) 
exits.

The second time will be when the TextIOWrapper is garbage-collected. This is 
documented behaviour 
, but I think it 
is a design mistake of the IOBase hierarchy; see Issue 19829.

A reasonable workaround would be to call encoder.detach() after you have 
finished writing the zip entry.

--
nosy: +martin.panter, serhiy.storchaka, takluyver
stage:  -> needs patch

___
Python tracker 

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



[issue30000] Inconsistency in the zlib module

2017-04-07 Thread Martin Panter

Martin Panter added the comment:

I don’t have a strong opinion on adding the missing parameters to the one-shot 
“compress” function, though it does seem beneficial to have a consistent set of 
parameters supported across the relevant APIs.

--

___
Python tracker 

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



[issue30003] Remove hz codec

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

"But for any codec, there might be archives, even if the codec is not
used for new files."

The bug is in the encoder. The codec is still usable to *decode*
files. So maybe a few people use it but didn't notice the encoder bug?

--

___
Python tracker 

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



[issue30019] IDLE freezes when opening a file with astral characters

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Your report touches on four different issues.

1. IDLE uses tkinter for the GUI and tkinter wraps tcl/tk 8.6 or earlier, which 
only handles Basic Multilingual Plane chars (codepoints  to ). The gun 
and knife chars are out of that range.  I have read that 8.7 will handle all 
unicode chars and that it might be released this year.  This will fix multiple 
IDLE issues (#21084, #22742, #13153, #14304).

2. Until 3.3, CPython used two internal unicode encoding schemes: Narrow and 
wide builds.  Narrow builds used pairs of surrogate chars in the BMP to 
represent chars not in the BMP.  So your '3 char' string is stored as 5 chars.

# -*- coding: utf-8 -*-
text = u"🔫 🔪"
for c in text:
print(ord(c))

*prints, on 2.7.13 on Windows
55357
56619
32
55357
56618

Windows releases and a few *nix releases used narrow builds.  I have Windows, 
so I could copy and paste your string and run the above.  Most *nix releases 
used wide builds and could not.

In 3.3, CPython switched to a flexible representation used on all releases.  
Like earlier wide builds, it does not use surrogate chars, and the above no 
longer loads into a text widget, let alone run.

3. Any exception not caught by IDLE generates a traceback that appears on the 
console used to start IDLE, if there is one.  Otherwise, it is lost.  Running 
" -m idlelib" in a console and loading the code above results in a 
traceback ending with "_tkinter.TclError: character U+1f52b is above the range 
(U+000)-(U+) allowed by Tcl".

I have though about (and previously commented about) trying to put such 
messages in a tk message box when IDLE and tk are still functioning well enough 
to do so before stopping.

4. It appears the IDLE opens a file that is not already open by creating a 
blank editor window and then loading the file into it.  In this case, when the 
load fails, a frozen window is left that blocks IDLE closing.  This nasty 
behavior, which I verified, is new to me, so I am leaving this issue open 
specifically for this bug.

A likely fix is to catch TclError in the appropriate place (not yet known to 
me), recover (delete the new EditorWindow and ???), display an explanatory 
error message, and continue when user hits [OK].

We already have a test string.  If needed, I will try to separate 'opening a 
file name' from 'reading the contents', so a test can use a simple mock file 
object.

If a file were opened and read *before* creating a new window, there would be 
less cleanup to do.

--
stage:  -> needs patch
title: IDLE got unexpexted bahavior when trying to use some characters -> IDLE 
freezes when opening a file with astral characters

___
Python tracker 

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



[issue30020] Make attrgetter use namedtuple

2017-04-07 Thread Isaac Morland

New submission from Isaac Morland:

I would find it useful if the tuples returned by attrgetter functions were 
namedtuples.  An initial look at the code for attrgetter suggests that this 
would be an easy change and should make little difference to performance.  
Giving a namedtuple where previously a tuple was returned seems unlikely to 
trigger bugs in existing code so I propose to simply change attrgetter rather 
than providing a parameter to specify whether or not to use the new behaviour.

Patch will be forthcoming but comments appreciated.

--
components: Library (Lib)
messages: 291314
nosy: Isaac Morland
priority: normal
severity: normal
status: open
title: Make attrgetter use namedtuple
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue30003] Remove hz codec

2017-04-07 Thread Ma Lin

Ma Lin added the comment:

>From my subjective feelings, probably no old archives still exist, but I can't 
>assert it. That's why I suggest remove it, or at least don't fix it.

Ah, let's slow down the pace, this bug exists over a dacade, we don't need to 
solve it at once.

I closed #24117, because it became a soup of small issues, so I split it into 
individual issues (such as this issue).

--

___
Python tracker 

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



[issue24117] Wrong range checking in GB18030 decoder.

2017-04-07 Thread Ma Lin

Ma Lin added the comment:

I closed this issue, because it involved too many things.
 
1, for GB18030 decoder bug, see issue29990.
2, for hz encoder bug, see issue30003.
3, for problem in Traditional Chinese codecs, please create a new issue.

--

___
Python tracker 

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



[issue30019] IDLE freezes when opening a file with astral characters

2017-04-07 Thread Eryk Sun

Eryk Sun added the comment:

In Windows IDLE 3.x, you should still be able to print a surrogate transcoding, 
which sneaks the native UTF-16LE encoding around tkinter:

def transurrogate(s):
b = s.encode('utf-16le')
return ''.join(b[i:i+2].decode('utf-16le', 'surrogatepass') 
   for i in range(0, len(b), 2))

def print_surrogate(*args, **kwds):
new_args = []
for arg in args:
if isinstance(arg, str):
new_args.append(transurrogate(s))
else:
new_args.append(arg)
return print(*new_args, **kwds)


>>> s = '\U0001f52b \U0001f52a'
>>> print_surrogate(s)
🔫 🔪

Pasting non-BMP text into IDLE fails on Windows for a similar reason. Tk 
naively encodes the surrogate codes in the native Windows UTF-16 text as 
invalid UTF-8, which I've seen refereed to as WTF-8 (Wobbly). I see the 
following error when I run IDLE using python.exe (i.e. with a console) and 
paste "🔫 🔪" into the window:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 1: 
invalid continuation byte

This is the second byte of the WTF-8 encoding:

>>> transurrogate('"\U0001f52b').encode('utf-8', 'surrogatepass')
b'"\xed\xa0\xbd\xed\xb4\xab'

Hackiness aside, I don't think it's worth supporting this just for Windows.

--
nosy: +eryksun

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2017-04-07 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
pull_requests: +1193

___
Python tracker 

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



[issue19225] lack of PyExc_BufferError doc

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 7f85947106aff5b1f166a57f644f987db4d38bf0 by Serhiy Storchaka 
(cocoatomo) in branch '2.7':
[2.7] bpo-19225: Lack of c api exceptions doc (#964)
https://github.com/python/cpython/commit/7f85947106aff5b1f166a57f644f987db4d38bf0


--

___
Python tracker 

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



[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I agree, that close() should be an idempotent operation. Proposed patch fixes 
this.

--
assignee:  -> serhiy.storchaka
components: +Library (Lib)
stage: needs patch -> patch review
versions: +Python 3.7

___
Python tracker 

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



[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1194

___
Python tracker 

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



[issue30020] Make attrgetter use namedtuple

2017-04-07 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Before writing a patch that may be rejected, can you explain in detail what 
change you propose? Example(s) will be good.

For example:

py> from operator import attrgetter
py> f = attrgetter('keys')
py> f({})


I don't see a tuple here, so what (if anything) are you planning to change?


How about the example from help(attrgetter)?

 |  After h = attrgetter('name.first', 'name.last'), the call h(r) returns
 |  (r.name.first, r.name.last).

--
nosy: +steven.daprano

___
Python tracker 

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



[issue23894] lib2to3 doesn't recognize rb'...' and f'...' in Python 3.6

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Should this issue be closed now?

--

___
Python tracker 

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



[issue29956] math.exp documentation is misleading

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Not always. For example for x = 0 both methods give the same exact result.

--

___
Python tracker 

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



[issue29914] Incorrect signatures of object.__reduce__() and object.__reduce_ex__()

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9 by Serhiy Storchaka in 
branch 'master':
bpo-29914: Fix default implementations of __reduce__ and __reduce_ex__(). (#843)
https://github.com/python/cpython/commit/205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9


--

___
Python tracker 

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



[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset b785396ab451b0c9d6ae9ee5a9e56c810209a6cb by Serhiy Storchaka in 
branch 'master':
bpo-29998: Pickling and copying ImportError now preserves name and path (#1010)
https://github.com/python/cpython/commit/b785396ab451b0c9d6ae9ee5a9e56c810209a6cb


--

___
Python tracker 

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



[issue29914] Incorrect signatures of object.__reduce__() and object.__reduce_ex__()

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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