[issue30660] Lossless Optimization of PNG files

2017-06-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace()

2017-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, wrong issue.

--

___
Python tracker 

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



[issue30662] fix OrderedDict.__init__ docstring to reflect PEP 468

2017-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Currently there are two implementations of OrderedDict, and Python 
implementation is not used. Is C implementation need an update? What about the 
module documentation, is it need an update?

I don't think that we should include such details about past Python versions in 
docstrings. I can't remember precedences.

--

___
Python tracker 

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



[issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace()

2017-06-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
Removed message: http://bugs.python.org/msg295986

___
Python tracker 

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



[issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace()

2017-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Currently there are two implementations of OrderedDict, and Python 
implementation is not used. Is C implementation need an update? What about the 
module documentation, is it need an update?

I don't think that we should include such details about past Python versions in 
docstrings. I can't remember precedences.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace()

2017-06-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This looks fine.

--

___
Python tracker 

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



[issue30509] Optimize calling type slots

2017-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Without Py_LOCAL_INLINE all mickrobenchmarks become about 20% slower.

I'm not sure that all these changes are needed. Maybe the same effect can be 
achieved by smaller changes. But I tried and failed to achieve the same 
performance with a smaller patch yet. Maybe you will be more lucky.

Note that even with this patch type slots still about 5% slower than ordinal 
methods (despite the fact that using operators needs less bytecode instructions 
than calling a method). There is some additional overhead.

--

___
Python tracker 

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



[issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace()

2017-06-13 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue30662] fix OrderedDict.__init__ docstring to reflect PEP 468

2017-06-13 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger
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



[issue30662] fix OrderedDict.__init__ docstring to reflect PEP 468

2017-06-13 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: ensurepip

2017-06-13 Thread Pavol Lisy
$ python3 -m ensurepip
/usr/bin/python3: No module named ensurepip

But maybe this help to understand:

$ python -m ensurepip
ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules For the system python are usually handled by dpkg and apt-get.

apt-get install python-

Install the python-pip package to use pip itself.  Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.


On 6/14/17, Steven D'Aprano  wrote:
> ensurepip is added in Python 3.4:
>
> https://docs.python.org/3/library/ensurepip.html
>
>
> But:
>
> root@runes:~# python3.4 -m ensurepip
> /usr/bin/python3.4: No module named ensurepip
>
>
>
> Any clues on what is going on or how to diagnose this?
>
>
>
>
> --
> Steve
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30662] fix OrderedDict.__init__ docstring to reflect PEP 468

2017-06-13 Thread Jonathan Eunice

Changes by Jonathan Eunice :


--
pull_requests: +2232

___
Python tracker 

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



[issue27485] urllib.splitport -- is it official or not?

2017-06-13 Thread Martin Panter

Martin Panter added the comment:

I don't think it is worth changing the implementations to be in terms of 
urlsplit or urlparse. This is proposed for splithost in 
, but I suspect it would change 
the behaviour in some corner cases. See Issue 22852 for some deficiencies with 
urlsplit.

3. Change existing usage to the internal _split functions, unless there is a 
reason (bug or security problem) to make further changes.

--

___
Python tracker 

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



[issue30662] fix OrderedDict.__init__ docstring to reflect PEP 468

2017-06-13 Thread Jonathan Eunice

New submission from Jonathan Eunice:

In Python 3.6 and current repo (pre-3.7), the docstring for 
collections.OrderedDict.__init__() stats that keyword argument order is 
arbitrary. That is untrue if I properly understand PEP 468, which as of Python 
3.6 makes the order of kwargs stable / identical to the order seen in the 
source code.

Associated PR imminent.

--
components: Library (Lib)
messages: 295982
nosy: jonathaneunice
priority: normal
severity: normal
status: open
title: fix OrderedDict.__init__ docstring to reflect PEP 468
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



ensurepip

2017-06-13 Thread Steven D'Aprano
ensurepip is added in Python 3.4:

https://docs.python.org/3/library/ensurepip.html


But:

root@runes:~# python3.4 -m ensurepip
/usr/bin/python3.4: No module named ensurepip



Any clues on what is going on or how to diagnose this?




-- 
Steve
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

f:\dev\36>python -m test -R: -ugui test_idle
gives about 40 invoke event messages, but the test passes.  So the messages and 
leaks are not connected.

--

___
Python tracker 

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



[issue15786] IDLE code completion window can hang or misbehave with mouse

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Now that I know how to backport with confidence, and have cleared the backlog, 
and synched 3.6 with 3.7, I want to review this next.  I would like to get it 
in 6.2, but 6.2 was due yesterday, but delayed, and there is no info on how 
long the delay is.  This may be one of the harder patches to review and test, 
but I will try tomorrow. (Its midnight here now.)

My main concern is that we not break one thing while fixing another, which I 
have done before, due to inadequate tests.  I will try to develop a test 
protocol from doc subsection 2.2 Completions to list what works without the 
patch.

--

___
Python tracker 

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



[issue15786] IDLE code completion window can hang or misbehave with mouse

2017-06-13 Thread Louie Lu

Louie Lu added the comment:

Terry, would you like to verify the fixed? I think it will be good if this fix 
can be backported in 3.6 before 3.6.2 released.

--

___
Python tracker 

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



[issue30628] why venv install old pip?

2017-06-13 Thread Nick Coghlan

Nick Coghlan added the comment:

Emily's answer sort of covered the "It's not as simple as it might seem" 
aspect, whereby the bit that's genuinely tricky is to provide access to the 
system pip(/setuptools/wheel) without providing accessing to the system site 
packages in general.

If the latter is actually considered desirable, then the most suitable venv 
configuration is likely to be:

python3 -m venv --system-site-packages --without-pip

as that will give you a fresh venv to install your own additions into, but use 
the system pip package by default, rather than automatically bootstrapping a 
venv specific instance of it.

We don't currently discuss that kind of hybrid configuration in the docs, so it 
may be appropriate to reopen this as a docs issue, and add a new "How do I use 
system level Python packages from a virtual environment?" question to 
https://docs.python.org/3/installing/#how-do-i

--

___
Python tracker 

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



[issue25514] Improve IDLE's "subprocess didn't make connection" message

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 22d909f8c24bd7768df1a5bf0e52c597ea947cfb by terryjreedy in branch 
'3.6':
[3.6]bpo-25514: Improve IDLE's connection refused message (#2177) (#2178)
https://github.com/python/cpython/commit/22d909f8c24bd7768df1a5bf0e52c597ea947cfb


--

___
Python tracker 

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



[issue30661] Support tarfile.PAX_FORMAT in shutil.make_archive

2017-06-13 Thread Nick Coghlan

Nick Coghlan added the comment:

The main benefit I'd see to the last option is that it would also cover passing 
a "filter" option for tarfile.TarFile.add(). Dropping down to the lower level 
API for that isn't *hard*, it's just a bit fiddly (note: currently untested 
example code):

   sdist = tarfile.open(sdist_path, "w:gz", format=tarfile.PAX_FORMAT)
   sdist.add(os.getcwd(), arcname=sdist_subdir, 
filter=_exclude_hidden_and_special_files)

--

___
Python tracker 

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



[issue25514] Improve IDLE's "subprocess didn't make connection" message

2017-06-13 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2231

___
Python tracker 

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



[issue25514] Improve IDLE's "subprocess didn't make connection" message

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 188aedf8bb623d41302e10503268b0852ea91134 by terryjreedy in branch 
'master':
bpo-25514: Improve IDLE's connection refused message (#2177)
https://github.com/python/cpython/commit/188aedf8bb623d41302e10503268b0852ea91134


--

___
Python tracker 

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



[issue30661] Support tarfile.PAX_FORMAT in shutil.make_archive

2017-06-13 Thread Nick Coghlan

New submission from Nick Coghlan:

shutil.make_archive currently just uses the default tar format, which is 
GNU_FORMAT.

This format doesn't ensure that all character paths are encoded as UTF-8, and 
hence may end up embedding platform specific encoding assumptions into the 
generated tarball.

I see a few possible ways of resolving this:

1. Change the default tar format to PAX_FORMAT. It's been 16 years since that 
was defined, and Python itself has supported it since 2.6 was released in 2008, 
so perhaps we can rely on other tools supporting it now? (My main open question 
on that front would be "What happens if you specify "format=GNU_FORMAT" when 
attempting to read a PAX formatted archive?)

2. Add new shutil level "pax", "gzpax", "bzpax", "xzpax" format definitions to 
explicitly request PAX_FORMAT

3. Add a mechanism to shutil.make_archive that allows format-dependent settings 
to be based down to the underlying archive creation functions (e.g. 
"format=tarfile.PAX_FORMAT").

--
messages: 295974
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Support tarfile.PAX_FORMAT in shutil.make_archive
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



[issue30628] why venv install old pip?

2017-06-13 Thread R. David Murray

R. David Murray added the comment:

OK, so the key here is venv's dependency on a pip wheel.  That makes sense, but 
is certainly counterintuitive.  One would naively think that having a copy of 
PIP installed would make it easy to link that into the venv, but obviously it 
is a lot more complex than that, given pip's dependencies.  Thanks for the 
explanation.

--

___
Python tracker 

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



Re: Test String Contents

2017-06-13 Thread Peter Otten
Peter Otten wrote:

> Matt wrote:
> 
>> What is easiest way to determine if a string ONLY contains a-z upper
>> or lowercase.  I also want to allow the "-" and "_" symbols.  No
>> spaces or anything else.
> 
> If you don't know regular expressions here's a method where not much can
> go wrong:

... with the exception of the empty string.

If you want to reject empty strings you need to add an explicit test:

if s and acceptable(s):
print("OK")

 import string
 acceptable = frozenset(string.ascii_letters + "_-").issuperset
 acceptable("Foo-Bar")
> True
 acceptable("Foo-Bar42")
> False
 acceptable("Foo Bar")
> False
 acceptable(string.ascii_letters + "_-")
> True

By the way, I find that behaviour more intuitive than that of the 
str.isXXX() methods as e. g.

s.isdigit() 

will differ from

all(c.isdigit() for c in s)

for the empty string. 

What do you think, are all apples in an empty basket red or not?

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30655] speech module

2017-06-13 Thread R. David Murray

Changes by R. David Murray :


--
resolution: not a bug -> third party

___
Python tracker 

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



[issue25514] Improve IDLE's "subprocess didn't make connection" message

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I tested (and tweaked) the visible box with this:
from idlelib.run import show_socket_error
show_socket_error(OSError(61, 'connection refused'), ('port', ))
URL was tested with cut-and-paste from run.py.

This should be turned into an htest (human view test).  I did not do so now 
because I wanted get this into 3.6.2, and there is no indication of when the 
grace-period delay will end.

Message boxes do not allow copy to clipboard.  A nice refinement would be a 
[View URL] button.  I believe the code to do so is somewhere in IDLE.  Or the 
F1 Python Docs code, which opens the Windows help version, should be adjustable 
to open to a specific topic.

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

___
Python tracker 

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



[issue30658] Buildbot: don't sent email notification for custom builders

2017-06-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

This is not a cpython issue, is it?

--
nosy: +Mariatta

___
Python tracker 

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



[issue25514] Improve IDLE's "subprocess didn't make connection" message

2017-06-13 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2230

___
Python tracker 

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



[issue30628] why venv install old pip?

2017-06-13 Thread Nick Coghlan

Nick Coghlan added the comment:

The upstream supported install path for bootstrapping the venv is from a wheel 
file. The CPython source tree contains the necessary wheels, and, by default, 
upgrading the system pip doesn't touch them.

The only distro I can speak authoritatively for when it comes to doing things 
differently is Fedora, and what we do is:

- add a circular dependency between the system Python & the system pip
- add a circular dependency between the system Python & Fedora's "rewheel" 
utility
- patch CPython to remove the bundled wheel files
- patch ensurepip to "rewheel" the system pip and install that into freshly 
bootstrapped virtual environments

The end result works, but it really isn't pretty from a distro maintenance 
perspective, so not every distro is going to want to do it (Fedora has the 
luxury of Red Hat's Python maintenance team also maintaining the Fedora system 
Python).

It also isn't currently practical for upstream to make it work that way by 
default due to:

* the implied external dependency on the system pip (which not every distro is 
going to have)
* the need to recreate a wheel from an already installed package (which isn't 
officially supported by distutils-sig as a valid thing to do)
* the fact some distro's unbundle pip's vendored dependencies, so rewheeling 
just pip isn't necessarily sufficient (it is on Fedora, but that's only because 
we leave the vendored dependencies in place and trust pip to issue new updates 
promptly when necessary)
* the fact that not every distro lays down the distutils-metadata needed to get 
tools like rewheel to work (Debian's equivalent, dirtbike, uses deb metadata 
instead)

--

___
Python tracker 

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



[issue30660] Lossless Optimization of PNG files

2017-06-13 Thread Tiago Filipe Silva

New submission from Tiago Filipe Silva:

I took the liberty to apply tools that optimize the binary weight (without loss 
of quality) of the 14 PNG files present in the Python 3.7 source tree and then 
applied a pull request (#2141).

Is there anything to be discussed? Thanks.

--
messages: 295969
nosy: tfs
priority: normal
pull_requests: 2229
severity: normal
status: open
title: Lossless Optimization of PNG files
type: resource usage
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



[issue20485] Enable non-ASCII extension module names

2017-06-13 Thread Nick Coghlan

Nick Coghlan added the comment:

PEP 489 was accepted and implemented, so Python 3.5+ supports non-ASCII 
extension module names as described in 
https://www.python.org/dev/peps/pep-0489/#export-hook-name

--
resolution:  -> fixed
stage: test needed -> 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



Re: Test String Contents

2017-06-13 Thread Thomas Nyberg
On 06/13/2017 03:34 PM, Matt wrote:
> What is easiest way to determine if a string ONLY contains a-z upper
> or lowercase.  I also want to allow the "-" and "_" symbols.  No
> spaces or anything else.
> 
I'm not sure it's the best way, but the following seems okay:

>>> s = 'hello_world'
>>> s.replace('-','').replace('_','').isalpha()
True
>>> s = 'hello world'
>>> s.replace('-','').replace('_','').isalpha()
False
>>>

Cheers,
Thomas
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27485] urllib.splitport -- is it official or not?

2017-06-13 Thread Cheryl Sabella

Cheryl Sabella added the comment:

Thank you.

>From my understanding, urllib didn't officially supported the split* functions 
>(splittype, splithost, splitport, splinport, splituser, splitpasswd, 
>splitattr, splitquery, splitvalue, splittag) even though they were migrated to 
>urllib.parse.  The 2.7 documentation recommended using urlparse and stated 
>that these split* functions would not be exposed in Python 3, but they are.

The proposal would be as Senthil suggested - to raise a DeprecationWarning if 
the current names are used and to rename them with a single underscore (to 
_split*).

However, I did have some questions.  
1. With the DeprecationWarning for the current function names, should the 
return value be a call to the _split* function or should it call 
urlparse/urlsplit?
2. Some of the return values from these split* functions can be different than 
urlsplit, as Martin showed in msg270215.  It seems that the return values 
should remain the same for now, but would the differences need to be 
documented? 
3. These functions are used in requests.py.  Should they be changed to use the 
_split* functions or changed to use urlparse?

--

___
Python tracker 

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



Re: Test String Contents

2017-06-13 Thread Peter Otten
Matt wrote:

> What is easiest way to determine if a string ONLY contains a-z upper
> or lowercase.  I also want to allow the "-" and "_" symbols.  No
> spaces or anything else.

If you don't know regular expressions here's a method where not much can go 
wrong:

>>> import string
>>> acceptable = frozenset(string.ascii_letters + "_-").issuperset
>>> acceptable("Foo-Bar")
True
>>> acceptable("Foo-Bar42")
False
>>> acceptable("Foo Bar")
False
>>> acceptable(string.ascii_letters + "_-")
True


-- 
https://mail.python.org/mailman/listinfo/python-list


Test String Contents

2017-06-13 Thread Matt
What is easiest way to determine if a string ONLY contains a-z upper
or lowercase.  I also want to allow the "-" and "_" symbols.  No
spaces or anything else.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27485] urllib.splitport -- is it official or not?

2017-06-13 Thread Brett Cannon

Brett Cannon added the comment:

Go for it, Cheryl!

--

___
Python tracker 

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



[issue27485] urllib.splitport -- is it official or not?

2017-06-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Skimming the issue I can't even figure out what the task is -- Cheryl, I 
suppose you have, could you post a brief summary of your plan here?

--

___
Python tracker 

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



Re: How to store some elements from a list into another

2017-06-13 Thread Grant Edwards
On 2017-06-13, Peter Otten <__pete...@web.de> wrote:
> Grant Edwards wrote:
>
>> On 2017-06-13, Peter Otten <__pete...@web.de> wrote:
>> 
 def edges(items): # where items is a non-empty iterator
 first = next(items)
 last = functools.reduce(sekond, items, first)
 return [first, last]
 
 Of course, right?
>>>
>>> Yeah, reduce() is certainly the cherry on the itertools cake ;)
>> 
>> Is the optional initializer the only difference between
>> functools.reduce() and the builtin reduce()?
>
> I don't think there's a difference at all -- at least the docstrings are the 
> same:
>
> $ python -c 'import functools; print functools.reduce.__doc__ == 
> reduce.__doc__; print reduce.__doc__'
> True
> reduce(function, sequence[, initial]) -> value

Hmm.  I don't know where I got the impression that the built-in didn't
support the optional initializer.  It's clearly there in the official
docs.  I must have been accidentally looking at one of those bogus
"tutorial" sites that have managed to fool Google into thinking
they're not worthless tripe.

> Note that the builtin was removed in Python 3.

Yep, I just figured that out.  [I still use 2.7 for most of my
quick/small applications since being able to freely mix strings and
bytes saves a lot of hassle for the work I do.]

-- 
Grant Edwards   grant.b.edwardsYow! We just joined the
  at   civil hair patrol!
  gmail.com

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30649] test_utime_current_old() of test_os fails randomy on x86 Windows7 3.6

2017-06-13 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2228

___
Python tracker 

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



[issue30645] imp.py: load_package() appends to its own loop variable

2017-06-13 Thread Brett Cannon

Changes by Brett Cannon :


--
title: imp.py: load_package: function has a buggy loop with `path = 
os.path.join(path, '__init__'+extension)` -> imp.py: load_package() appends to 
its own loop variable

___
Python tracker 

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



[issue30645] imp.py: load_package: function has a buggy loop with `path = os.path.join(path, '__init__'+extension)`

2017-06-13 Thread Brett Cannon

Brett Cannon added the comment:

Three things.

One, the imp module is deprecated, so please don't use it.

Two, all undocumented functions in the imp module are considered unsupported, 
so double-please don't use imp.load_package(). :)

Three, we can't look at that patch without the person supplying it signing 
Python's CLA as we risk running afoul of things legally.

--

___
Python tracker 

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



[issue30509] Optimize calling type slots

2017-06-13 Thread STINNER Victor

STINNER Victor added the comment:

I'm not sure about adding Py_LOCAL_INLINE() (static inline). I'm not sure that 
it's needed when you use PGO compilation.

Would it be possible to run again your benchmark without added 
Py_LOCAL_INLINE() please?

It's hard to say no to a change makes so many core Python functions faster. I'm 
just suprised that "specializing" the "call_unbound" and "call_method" 
functions make the code up to 1.2x faster.

--

___
Python tracker 

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



[issue27485] urllib.splitport -- is it official or not?

2017-06-13 Thread Cheryl Sabella

Cheryl Sabella added the comment:

Would it be OK for me to work on this?

--
nosy: +csabella

___
Python tracker 

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



[issue30649] test_utime_current_old() of test_os fails randomy on x86 Windows7 3.6

2017-06-13 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +2227

___
Python tracker 

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



[issue30595] test_queue_feeder_donot_stop_onexc() of test_multiprocessing_spawn fails randomly on x86 Windows7 3.x

2017-06-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 8f6eeaf21cdf4aea25fdefeec814a1ce07453fe9 by Victor Stinner in 
branch 'master':
bpo-30595: Increase test_queue_feeder_donot_stop_onexc() timeout (#2148)
https://github.com/python/cpython/commit/8f6eeaf21cdf4aea25fdefeec814a1ce07453fe9


--

___
Python tracker 

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



[issue30649] test_utime_current_old() of test_os fails randomy on x86 Windows7 3.6

2017-06-13 Thread STINNER Victor

STINNER Victor added the comment:


New changeset c94caca65cd38802243b5279cf85ee44ffb2abb8 by Victor Stinner in 
branch 'master':
bpo-30649: test_os tolerates 50 ms delta for utime (#2156)
https://github.com/python/cpython/commit/c94caca65cd38802243b5279cf85ee44ffb2abb8


--

___
Python tracker 

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



[issue30645] imp.py: load_package: function has a buggy loop with `path = os.path.join(path, '__init__'+extension)`

2017-06-13 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +brett.cannon, eric.snow, ncoghlan, r.david.murray

___
Python tracker 

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



Re: How to store some elements from a list into another

2017-06-13 Thread Peter Otten
Grant Edwards wrote:

> On 2017-06-13, Peter Otten <__pete...@web.de> wrote:
> 
>>> def edges(items): # where items is a non-empty iterator
>>> first = next(items)
>>> last = functools.reduce(sekond, items, first)
>>> return [first, last]
>>> 
>>> Of course, right?
>>
>> Yeah, reduce() is certainly the cherry on the itertools cake ;)
> 
> Is the optional initializer the only difference between
> functools.reduce() and the builtin reduce()?

I don't think there's a difference at all -- at least the docstrings are the 
same:

$ python -c 'import functools; print functools.reduce.__doc__ == 
reduce.__doc__; print reduce.__doc__'
True
reduce(function, sequence[, initial]) -> value

Apply a function of two arguments cumulatively to the items of a sequence,
from left to right, so as to reduce the sequence to a single value.
For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
1+2)+3)+4)+5).  If initial is present, it is placed before the items
of the sequence in the calculation, and serves as a default when the
sequence is empty.
$

Note that the builtin was removed in Python 3.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue1360] Queue.get() can't be interrupted with Ctrl-C unless timed out

2017-06-13 Thread Guido van Rossum

Guido van Rossum added the comment:

This issue is closed, but you can open a new issue to flag this in the docs.

--

___
Python tracker 

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



Re: How to store some elements from a list into another

2017-06-13 Thread Grant Edwards
On 2017-06-13, Peter Otten <__pete...@web.de> wrote:

>> def edges(items): # where items is a non-empty iterator
>> first = next(items)
>> last = functools.reduce(sekond, items, first)
>> return [first, last]
>> 
>> Of course, right?
>
> Yeah, reduce() is certainly the cherry on the itertools cake ;)

Is the optional initializer the only difference between
functools.reduce() and the builtin reduce()?

-- 
Grant Edwards   grant.b.edwardsYow! I know th'MAMBO!!
  at   I have a TWO-TONE CHEMISTRY
  gmail.comSET!!

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to store some elements from a list into another

2017-06-13 Thread Peter Otten
Jussi Piitulainen wrote:

> Peter Otten writes:
> 
> ...
> 
>> def edges(items):
>> first = last = next(items)
>> for last in items:
>> pass
>> return [first, last]
> 
> ...
> 
>> However, this is infested with for loops. Therefore
> 
> ...
> 
>> I don't immediately see what to do about the for loop in edges(), so
>> I'll use the traditional cop-out: Removing the last loop is left as an
>> exercise...
> 
> In the spirit of the exercise:
> 
> def sekond(x, y):
> return y
> 
> def edges(items): # where items is a non-empty iterator
> first = next(items)
> last = functools.reduce(sekond, items, first)
> return [first, last]
> 
> Of course, right?

Yeah, reduce() is certainly the cherry on the itertools cake ;)

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue1360] Queue.get() can't be interrupted with Ctrl-C unless timed out

2017-06-13 Thread Stephen Rosen

Stephen Rosen added the comment:

Can a note be added to the Queue.get() documentation?

This behavior has been known to be at least potentially confusing for a decade, 
and there's no mention of it in the documentation.

--
nosy: +Stephen Rosen
versions: +Python 2.7 -Python 2.5

___
Python tracker 

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



[issue30657] Unsafe arithmetic in PyString_DecodeEscape

2017-06-13 Thread Jay Bosamiya

Jay Bosamiya added the comment:

I've made a patch that should fix the vulnerability. Please do let me know if 
changes are required. Thanks a lot :)

PS: For anyone who looks at this later on, in my original message describing 
the issue, the line `*p++ = *s++;` should be marked as (4) instead to 
understand this issue better.

--

___
Python tracker 

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



[issue30657] Unsafe arithmetic in PyString_DecodeEscape

2017-06-13 Thread Jay Bosamiya

Changes by Jay Bosamiya :


--
pull_requests: +2226

___
Python tracker 

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



[issue27922] Make IDLE tests less flashy

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Using findleak.py, attached to #30642, modified to always print the filename, I 
discovered that test_parenmatch also flashes (along with test_searchbase).  The 
leak test runs each test_xyz module 9 times, so is a good way to see flashing.

Adding 'root.withdraw' stops the single flash when running test_parenmatch 
once.  However, it does not stop flashing when running 9 times with -R: refleak 
test.  Flash continues even if class is reduced to

class ParenMatchTest(unittest.TestCase):

@classmethod
def setUpClass(cls):
cls.root = Tk()
cls.root.withdraw()

@classmethod
def tearDownClass(cls):
cls.root.destroy()
del cls.root

def test_dummy(self): pass

This is a puzzle since the same skeleton is in several other files.  In fact, 
at least one, test_autocomplete, does not even have root.withdraw. In any case, 
I will add it here.

--

___
Python tracker 

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



[issue27922] Make IDLE tests less flashy

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset d92ee3ea622b6eee5846681bad5595cfedcf20b6 by terryjreedy in branch 
'3.6':
[3.6]bpo-27922: Stop gui flash from idle_test.test_parenmatch (#2171) (#2172)
https://github.com/python/cpython/commit/d92ee3ea622b6eee5846681bad5595cfedcf20b6


--

___
Python tracker 

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



[issue30646] SQLite: sqlite3_enable_shared_cache() is deprecated

2017-06-13 Thread Ronald Oussoren

Ronald Oussoren added the comment:

See also . Apple basically 
disabled this function starting at macOS 10.7, that's why there's a warning.

It is possible to suppress the warning, but I don't think its worth the trouble.

BTW. The python documentation for this function claims this changes a 
thread-local setting, but the SQLite documentation says this is a process 
global setting in SQLite 3.5.0 and later (released in 2007).  It is possible to 
make behaviour match the python documentation by making 
_sqlite3.enable_shared_cache store a flag that's used in the call to 
sqlite3_open_v2. That would be a backward compatibility concern (there's bound 
to be users that rely on the current behavior), but would also avoid this 
warning.

--

___
Python tracker 

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



[issue30509] Optimize calling type slots

2017-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

$ ./python -m perf timeit -q --compare-to=./python-orig -s 'class A:' -s '  def 
__add__(s, o): return s' -s 'a = A(); b = A()' --duplicate=100 'a.__add__(b)'
Mean +- std dev: [python-orig] 229 ns +- 9 ns -> [python] 235 ns +- 13 ns: 
1.02x slower (+2%)

$ ./python -m perf timeit -q --compare-to=./python-orig -s 'class A:' -s '  def 
__add__(s, o): return s' -s 'a = A(); b = A()' --duplicate=100 'a + b'
Mean +- std dev: [python-orig] 277 ns +- 10 ns -> [python] 251 ns +- 23 ns: 
1.10x faster (-9%)

$ ./python -m perf timeit -q --compare-to=./python-orig -s 'class A:' -s '  def 
__add__(s, o): return s' -s 'a = [A() for i in range(1000)]' 'sum(a, A())'
Mean +- std dev: [python-orig] 259 us +- 17 us -> [python] 218 us +- 16 us: 
1.19x faster (-16%)

$ ./python -m perf timeit -q --compare-to=./python-orig -s 'class A:' -s '  def 
__getitem__(s, i): return t[i]' -s 'a = A(); t = tuple(range(1000))' 'list(a)'
Mean +- std dev: [python-orig] 324 us +- 14 us -> [python] 300 us +- 16 us: 
1.08x faster (-8%)

$ ./python -m perf timeit -q --compare-to=./python-orig -s 'class A:' -s '  def 
__neg__(s): return s' -s 'a = A()' --duplicate=100 '(--a)'
Mean +- std dev: [python-orig] 2.12 us +- 0.13 us -> [python] 1.91 us +- 0.11 
us: 1.11x faster (-10%)

--

___
Python tracker 

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



[issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace()

2017-06-13 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> backport needed
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace()

2017-06-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 184bd82ba8106785ba22f0d2477dbd08bef821fb by Mariatta (Ben Hoyt) 
in branch 'master':
bpo-30659 : Use ** for kwargs in namedtuple._replace() signature (GH-2173)
https://github.com/python/cpython/commit/184bd82ba8106785ba22f0d2477dbd08bef821fb


--
nosy: +Mariatta

___
Python tracker 

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



Re: Progress on the Gilectomy

2017-06-13 Thread Skip Montanaro
On Tue, Jun 13, 2017 at 1:53 PM, Terry Reedy  wrote:

> This was tried at least once, perhaps 15 years ago.


Yes, I believe Greg Smith (?) implemented a proof-of-concept in about the
Python 1.4 timeframe. The observation at the time was that it slowed down
single-threaded programs too much to be accepted as it existed then. That
remains the primary bugaboo as I understand it. It seems Larry has pushed
the envelope a fair bit farther, but there are still problems.

I don't know if the Gilectomy code changes are too great to live along the
mainline branches, but I wonder if having a bleeding-edge-gilectomy branch
in Git (maintained alongside the regular stuff, but not formally released)
would

a) help it stay in sync better with CPython
b) expose the changes to more people, especially extension module authors

Combined, the two might make it so the GIL-free branch isn't always playing
catchup (because of 'a') and more extension modules get tweaked to work
properly in a GIL-free world (because of 'b'). I imagine Larry Hastings has
given the idea some consideration.

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30603] textwrap: declining indent level has no test case

2017-06-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 601483d3b8a0433ca25f7fd6beea2cef674be039 by Mariatta (Jonathan 
Eunice) in branch 'master':
bpo-30603: Add test case to textwrap.dedent (GH-2014)
https://github.com/python/cpython/commit/601483d3b8a0433ca25f7fd6beea2cef674be039


--
nosy: +Mariatta

___
Python tracker 

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



[issue25514] Improve IDLE's "subprocess didn't make connection" message

2017-06-13 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Removed file: http://bugs.python.org/file40915/dia2.py

___
Python tracker 

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



[issue25514] Improve IDLE's "subprocess didn't make connection" message

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Thanks for the reminder to get busy on this ;-). My short notes are 
insufficient for anyone else to write this.

--
assignee: docs@python -> terry.reedy

___
Python tracker 

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



Re: Progress on the Gilectomy

2017-06-13 Thread Terry Reedy

On 6/13/2017 12:09 PM, Robin Becker wrote:

On 11/06/2017 07:27, Steve D'Aprano wrote:



I'm tired of people complaining about the GIL as a "mistake" without
acknowledging that it exists for a reason.

I thought we were also consenting adults about problems arising from bad 
extensions. The GIL is a blocker for cpython's ability to use multi-core 
cpus.


When using threads, not when using multiple processes.

> The contention issues all arise from reference counting. Newer
> languages like go seem to prefer the garbage collection approach.
> Perhaps someone should try a reference-countectomy,

This was tried at least once, perhaps 15 years ago.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


[issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace()

2017-06-13 Thread Ben Hoyt

New submission from Ben Hoyt:

The documentation for namedtuple._replace() needs a tweak: currently its 
signature shows "kwargs" without the ** notation, indicating it's a single, 
positional argument. It should have the ** to indicate it's actually any number 
of keyword arguments.

See 
https://docs.python.org/3/library/collections.html#collections.somenamedtuple._replace
 and compare with the docs for the signature of Logger.debug() for example: 
https://docs.python.org/3/library/logging.html#logging.Logger.debug

--
assignee: docs@python
components: Documentation
messages: 295949
nosy: benhoyt, docs@python, rhettinger
priority: normal
pull_requests: 2225
severity: normal
status: open
title: Use ** correctly for "kwargs" in signature of namedtuple._replace()
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue27922] Make IDLE tests less flashy

2017-06-13 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2224

___
Python tracker 

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



[issue27922] Make IDLE tests less flashy

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 049cf2bb44038351e1b2eed4fc7b1b522329e550 by terryjreedy in branch 
'master':
bpo-27922: Stop gui flash from idle_test.test_parenmatch (#2171)
https://github.com/python/cpython/commit/049cf2bb44038351e1b2eed4fc7b1b522329e550


--

___
Python tracker 

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



[issue27922] Make IDLE tests less flashy

2017-06-13 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2223

___
Python tracker 

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



[issue30657] Unsafe arithmetic in PyString_DecodeEscape

2017-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report Jay. Even if it very unlikely that this can occurred 
unintentionally or be used for attack, this still is a bug and should be fixed. 
Do you want to provide a patch?

--
keywords: +easy (C)
stage:  -> needs patch

___
Python tracker 

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



[issue27922] Make IDLE tests less flashy

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Using findleak.py, attached to #30642, modified to always print the filename, I 
discovered that test_parenmatch also flashes (along with test_searchbase).  The 
leak test runs each test_xyz module 9 times, so is a good way to see flashing.

Adding 'root.withdraw' stops the single flash when running test_parenmatch 
once.  However, it does not stop flashing when running 9 times with -R: refleak 
test.  Flash continues even if class is reduced to

class ParenMatchTest(unittest.TestCase):

@classmethod
def setUpClass(cls):
cls.root = Tk()
cls.root.withdraw()

@classmethod
def tearDownClass(cls):
cls.root.destroy()
del cls.root

def test_dummy(self): pass

This is a puzzle since the same skeleton is in several other files.  In fact, 
at least one, test_autocomplete, does not even have root.withdraw. In any case, 
I will add it here.

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

___
Python tracker 

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



[issue30656] typo in PyModule_New documentation

2017-06-13 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage: commit review -> backport needed

___
Python tracker 

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



[issue30656] typo in PyModule_New documentation

2017-06-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 2d0afef82a07afdb666f2ca0c533aac5d39155cd by Mariatta (Emily 
Morehouse) in branch 'master':
bpo-30656: Fix Python C API Module Objects documentation (GH-2170)
https://github.com/python/cpython/commit/2d0afef82a07afdb666f2ca0c533aac5d39155cd


--
nosy: +Mariatta

___
Python tracker 

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



[issue30656] typo in PyModule_New documentation

2017-06-13 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue30628] why venv install old pip?

2017-06-13 Thread R. David Murray

R. David Murray added the comment:

It's not obvious from your discussion, Nick, *why* venv won't use an upgraded 
system pip if it has been manually upgraded.  There's no need for internet 
access in that case (which is the argument for using the bundled pip when 
running ensurepip for the first time).  For that matter, there's no obvious 
relationship between venv and ensurepip, other than ensurepip making sure there 
is at least one version of pip for venv to use.

So I agree with the OP that this behavior is quite surprising.  As well as 
annoying.  Perhaps there is a good reason for it that I'm not seeing?

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



[issue30641] No way to specify "File name too long" error in except statement.

2017-06-13 Thread R. David Murray

R. David Murray added the comment:

Since according to Eryk there's no way to have a reliable cross-platform 
exception class catching file name to long, I'm rejecting this feature request.

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



Re: Progress on the Gilectomy

2017-06-13 Thread Skip Montanaro
On Tue, Jun 13, 2017 at 11:09 AM, Robin Becker  wrote:

> I looked at Larry's talk with interest. The GIL is not a requirement as he
> pointed out at the end, both IronPython and Jython don't need it.


But they don't support CPython's extension module API either, I don't
think. (I imagine that might have been the point of your reference.)

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24744] Lack of type checks in pkgutil.walk_packages and friends

2017-06-13 Thread R. David Murray

R. David Murray added the comment:

Thanks, Sanyam.

--
resolution:  -> fixed
stage: needs patch -> 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



[issue24744] Lack of type checks in pkgutil.walk_packages and friends

2017-06-13 Thread R. David Murray

R. David Murray added the comment:


New changeset b9c3da5c89c66dcccf382e8f196746da2a06d4cc by R. David Murray 
(Sanyam Khurana) in branch 'master':
bpo-24744: Raises error in pkgutil.walk_packages if path is str (#1926)
https://github.com/python/cpython/commit/b9c3da5c89c66dcccf382e8f196746da2a06d4cc


--

___
Python tracker 

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



[issue30656] typo in PyModule_New documentation

2017-06-13 Thread Carol Willing

Changes by Carol Willing :


--
stage:  -> commit review

___
Python tracker 

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



[issue22898] segfault during shutdown attempting to log ResourceWarning

2017-06-13 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> We can't just remove PyExc_RecursionErrorInst since this can cause a stack 
> overflow

Please give an example where a stack overflow occurs when 
PyExc_RecursionErrorInst has been removed.

--

___
Python tracker 

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



[issue30656] typo in PyModule_New documentation

2017-06-13 Thread Michał Radwański

Changes by Michał Radwański :


--
pull_requests: +

___
Python tracker 

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



[issue30656] typo in PyModule_New documentation

2017-06-13 Thread Emily Morehouse

Emily Morehouse added the comment:

Good catch, fixed in PR.

--
nosy: +emilyemorehouse

___
Python tracker 

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



[issue30656] typo in PyModule_New documentation

2017-06-13 Thread Emily Morehouse

Changes by Emily Morehouse :


--
pull_requests: +2220

___
Python tracker 

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



[issue25514] Improve IDLE's "subprocess didn't make connection" message

2017-06-13 Thread Carol Willing

Carol Willing added the comment:

Based on Terry's latest message and recommendation, I've marked this as a 
Documentation issue and suitable for new contributors.

--
assignee:  -> docs@python
components: +Documentation
keywords: +easy
nosy: +docs@python, willingc

___
Python tracker 

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



Re: Progress on the Gilectomy

2017-06-13 Thread Robin Becker

On 11/06/2017 07:27, Steve D'Aprano wrote:



I'm tired of people complaining about the GIL as a "mistake" without
acknowledging that it exists for a reason.



I thought we were also consenting adults about problems arising from bad 
extensions. The GIL is a blocker for cpython's ability to use multi-core cpus.


I looked at Larry's talk with interest. The GIL is not a requirement as he 
pointed out at the end, both IronPython and Jython don't need it.


That said I think the approach he outlined is probably wrong unless we attach a 
very high weight to preserving the current extension interface. C extensions are 
a real nuisance.


The contention issues all arise from reference counting. Newer languages like go 
seem to prefer the garbage collection approach. Perhaps someone should try a 
reference-countectomy, but then they already have with other python implementations.

--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list


[issue30658] Buildbot: don't sent email notification for custom builders

2017-06-13 Thread STINNER Victor

New submission from STINNER Victor:

Sadly, our version of buildbot doesn't support branches. Other options:
http://docs.buildbot.net/latest/manual/cfg-reporters.html#mailnotifier-arguments

--
components: Tests
messages: 295936
nosy: haypo, zach.ware
priority: normal
severity: normal
status: open
title: Buildbot: don't sent email notification for custom builders
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



Re: How to store some elements from a list into another

2017-06-13 Thread breamoreboy
On Monday, June 12, 2017 at 7:33:03 PM UTC+1, José Manuel Suárez Sierra wrote:
> Hello,
> I am stuck with a (perhaps) easy problem, I hope someone can help me:
> 
> My problem is:
> I have a list of lists like this one:
> [[55, 56, 57, 58, 83, 84, 85, 86, 89, 90, 91, 92, 107, 108, 109, 110, 111, 
> 117, 118, 119, 120, 128, 129, 130, 131, 135, 136, 137, 138, 184, 185, 186, 
> 187, 216, 217, 218, 219, 232, 233, 234, 235, 236, 237, 238, 267, 268, 269, 
> 270, 272, 273, 274, 275], [2, 3, 4, 5, 9, 10, 11, 12, 21, 22, 23, 24, 29, 30, 
> 31, 32, 56, 57, 58, 59, 65, 66, 67, 68, 74, 75, 76, 77, 78, 89, 90, 91, 92, 
> 98, 99, 100, 101, 102, 125, 126, 127, 128, 131, 132, 133, 134, 135]]
> 
> And what I want is to store some of these datum into another list according 
> to the next conditions:
> 1. I just want to store data if these values are consecutive (four in four), 
> for instance, for first element I would like to store into the new list: 
> [[[55,58],[83,86],[n,n+3]]] and so on.
>  I tried something like this:
> 
> x=0
> y=0
> while list6[x][y] == list6[x][y+1]-1 and list6[x][y] == 
> list6[x][y+1]-2 and list6[x][y] == list6[x][y+1]-3 or list6[x][0]:
> 
> list7.append(list6[x][y])
> list7.append(list6[x][y+3])
> y = y+1
> if (list6[x][y])%(list6[x][len(list6[x])-1]) == 0:
> x= x+1
> 
> if len(list6[x]) == x and len(list6[x][y]) == y:
> break
> 
> 
> It does not work
> 
> I appreciate your help 
> Thank you

Perhaps use the recipe for consecutive numbers from here 
https://docs.python.org/2.6/library/itertools.html#examples  It will have to be 
modified for Python 3, I'll leave that as an exercise.

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30657] Unsafe arithmetic in PyString_DecodeEscape

2017-06-13 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue24484] multiprocessing cleanup occasionally throws exception

2017-06-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This should be fixed now.  Please reopen if not.

--
resolution:  -> fixed
stage: commit 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



[issue24484] multiprocessing cleanup occasionally throws exception

2017-06-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:


New changeset a0ecaab006849ade08fbcf8413fe1e92d9c8d71c by Antoine Pitrou in 
branch '3.5':
[3.5] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) 
(#2167)
https://github.com/python/cpython/commit/a0ecaab006849ade08fbcf8413fe1e92d9c8d71c


--

___
Python tracker 

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



[issue24484] multiprocessing cleanup occasionally throws exception

2017-06-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:


New changeset d09f1674d70dd84c5be37b5fe11bca4913146c6b by Antoine Pitrou in 
branch '2.7':
[2.7] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) 
(#2168)
https://github.com/python/cpython/commit/d09f1674d70dd84c5be37b5fe11bca4913146c6b


--

___
Python tracker 

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



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset b0efd493b6af24a6ae744e7e02f4b69c70e88f3d by terryjreedy in branch 
'3.6':
[3.6]bpo-30642: Fix ref leak in idle_test.test_macosx (#2163) (#2165)
https://github.com/python/cpython/commit/b0efd493b6af24a6ae744e7e02f4b69c70e88f3d


--

___
Python tracker 

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



[issue30593] sqlite3 executescript does not respect isolation_level?

2017-06-13 Thread Aviv Palivoda

Changes by Aviv Palivoda :


--
nosy: +palaviv

___
Python tracker 

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



[issue24484] multiprocessing cleanup occasionally throws exception

2017-06-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:


New changeset 6fd03459957ee53941183212457bba19f977679f by Antoine Pitrou in 
branch '3.6':
[3.6] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) 
(#2166)
https://github.com/python/cpython/commit/6fd03459957ee53941183212457bba19f977679f


--

___
Python tracker 

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



Re: How to decompile an exe file compiled by py2exe?

2017-06-13 Thread Irving Duran
This might be what you are looking for ->
https://stackoverflow.com/questions/6287918/how-to-decompile-an-exe-file-compiled-by-py2exe

On Tue, Jun 13, 2017 at 8:52 AM Xristos Xristoou  wrote:

> hello
>
> How to decompile an exe file compiled by py2exe?
> in my file i have a library.zip file i dont if that help this work.
>
> i need some easy because i am very new i try some programs but without
> results.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
Thank You,

Irving Duran
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30657] Unsafe arithmetic in PyString_DecodeEscape

2017-06-13 Thread Jay Bosamiya

New submission from Jay Bosamiya:

In Python 2.7, there is a possible integer overflow in
PyString_DecodeEscape function of the file stringobject.c, which can
be abused to gain a heap overflow, possibly leading to arbitrary code
execution.

The relevant parts of the code are highlighted below:

PyObject *PyString_DecodeEscape(const char *s,
Py_ssize_t len,
const char *errors,
Py_ssize_t unicode,
const char *recode_encoding)
{
int c;
char *p, *buf;
const char *end;
PyObject *v;
(1) Py_ssize_t newlen = recode_encoding ? 4*len:len;
(2) v = PyString_FromStringAndSize((char *)NULL, newlen);
if (v == NULL)
return NULL;
(3) p = buf = PyString_AsString(v);
end = s + len;
while (s < end) {
if (*s != '\\') {
  non_esc:
#ifdef Py_USING_UNICODE
[...]
#else
*p++ = *s++;
#endif
continue;
[...]
}
}
(4) if (p-buf < newlen)
_PyString_Resize(, p - buf); /* v is cleared on error */
return v;
  failed:
Py_DECREF(v);
return NULL;
}


(1) If recode_encoding is true (i.e., non-null), we have an integer
  overflow here which can set newlen to be some very small value
(2) This allows a small string to be created into v
(3) Now p (and buf) use that small string
(4) The small string is copied into with a larger string, thereby
  giving a heap buffer overflow

In the highly unlikely but definitely possible situation that we pass
it a very large string (in the order of ~1GB on a 32-bit Python
install), one can reliably get heap corruption. It is possible to
access this function (and condition in line(1)) through function
parsestr from ast.c, when the file encoding of an input .py file is
something apart from utf-8 and iso-8859-1. This can be trivially done
using the following at the start of the file:
# -*- coding: us-ascii -*-

The attached file (poc-gen.py) produces a poc.py file which satisfies
these constraints and shows the vulnerability.

Note: To see the vulnerability in action, it is necessary to have an
ASAN build of Python, compiled for 32 bit on a 64 bit machine.
Additionally, the poc.py file generated can take an extremely long
time to load (over a few hours), and finally crash. Instead, if one
wishes to see the proof of vulnerability quicker, then it might be
better to change the constant 4 in line (1) to 65536 (just for
simplicity sake), and change the multiplication_constant in poc-gen.py
file to be the same (i.e. 65536).

Proposed fix: Confirm that the multiplication will not overflow,
before actually performing the multiplication and depending on the
result.

--
components: Interpreter Core
files: poc-gen.py
messages: 295930
nosy: jaybosamiya
priority: normal
severity: normal
status: open
title: Unsafe arithmetic in PyString_DecodeEscape
type: security
versions: Python 2.7
Added file: http://bugs.python.org/file46950/poc-gen.py

___
Python tracker 

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



[issue24484] multiprocessing cleanup occasionally throws exception

2017-06-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Python 2.7 doesn't suffer from this bug, so no actual fix is needed. Still, 
I'll backport the additional test.

--
stage: needs patch -> commit review
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



  1   2   3   >