[issue31186] Support heapfix() and heapremove() APIs in heapq module

2017-08-11 Thread Rajath Agasthya

New submission from Rajath Agasthya:

I'd like to suggest a couple of utility methods for the heapq module which I 
think are useful:

1. heapfix() - Re-establishes heap invariant after item at 'any index' in the 
heap changes its value.

Currently, the way to fix the heap after an arbitrary item has changed is to 
just call heapify() on the entire heap. This is inefficient because heapify() 
tries to perform _siftup() operation on half of the items of the heap to 
maintain the heap invariant. Doing this is unnecessary because we know exactly 
which element (or index) was changed and became out of place. With a heapfix() 
function, we can just "fix" the heap from that position.

2. heapremove() - Removes an item at 'any index' from the heap and maintains 
heap invariant.

Pretty much same as above. If you remove an item from an arbitrary index, you 
have to call heapify() to restore the heap invariant.


Supporting these methods require minimal changes to the existing _siftup() and 
_siftdown() methods (basically just returning position values without changing 
any logic at all). I have a draft implementation which I've attached as a patch 
file here. If there's interest in this, I can write some tests and create a 
Github PR.

Thanks!

--
components: Library (Lib)
files: heapq_fix_remove.patch
keywords: patch
messages: 300190
nosy: rajathagasthya, rhettinger, stutzbach
priority: normal
severity: normal
status: open
title: Support heapfix() and heapremove() APIs in heapq module
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file47079/heapq_fix_remove.patch

___
Python tracker 

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



[issue1732367] Document the constants in the socket module

2017-08-11 Thread Martin Panter

Martin Panter added the comment:

Issue 13256 contains a patch documenting socket options, but was closed because 
the author lost interest.

Issue 27409 is a proposal to list the symbols available without documenting 
what each one is for.

--
dependencies: +Document and test new socket options, List socket.SO_*, SCM_*, 
MSG_*, IPPROTO_* symbols

___
Python tracker 

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



[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is this a bug fix or a new feature? Adding support of generators in issue21947 
was a new feature and was not backported to older versions.

--

___
Python tracker 

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



[issue31143] lib2to3 requires source files for fixes

2017-08-11 Thread Steve Dower

Steve Dower added the comment:

Perhaps the more important question is whether 2to3 really needs to dynamically 
generate a list of fixers or if that should have been stopped due to YAGNI. 
There are only a few modules in the stdlib, and it doesn't seem to support 
proper namespace packages, so unless there are plans to suddenly add many more 
we could just make it a hard coded list.

--

___
Python tracker 

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



[issue31142] python shell crashed while input quotes in print()

2017-08-11 Thread Ned Deily

Ned Deily added the comment:

Note that the web page states you need to use Tcl/Tk 8.5.18, and not 8.6.x.  
Both are available from ActiveState here:

https://www.activestate.com/activetcl/downloads

Try installing 8.5.18 (you don't need to uninstall 8.6.x) and your crashes 
should go away.

--
resolution:  -> third party
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



[issue31148] Can we get an MSI installer for something past 3.4.4?

2017-08-11 Thread D Gentry

D Gentry added the comment:

If you would like to keep track of others who would find it useful, I'd be
happy to contribute the msi to the community once its completed.

Also, any information or good references that you could recommend that
might aid in producing the installer would be appreciated.

Steve mentioned the temp directory as possibly being part of the problem
and that would make sense as its only when installer make use of this that
the issues seem to occur so I will definitely be looking at that as a
possible root cause for the failure.

Steve also mentioned that it's not as easy to produce an installer as it
may seem.I was wondering if you could elaborate some on what you mean.

On a scale of one to ten, with ten being the most difficult, how difficult
of a task would you say it is to create this as it seems you have some
experience doing this in the past and this will be my first attempt, so I
would like to know what I'm getting into before I start.

>From the Microsoft article on producing MSI installers,
https://msdn.microsoft.com/en-us/library/aa266427(v=vs.60).aspx#vehowbuildinginstallerpackagefileanchor1,
it seems fairly simple as long as you have Visual Studio.

Is there something I'm not seeing or understanding in the process?

Again, if you know of any references that might help educate me or direct
me through the process, these would be helpful.

I already have a couple strategies I'm thinking of to do this but I would
like to see what someone with some experience has to say regarding the
issue.

-David Gentry

On Thu, Aug 10, 2017 at 2:40 PM, Steve Dower  wrote:

>
> Steve Dower added the comment:
>
> > when we changed installers was that when we also fixed the
> security/permissions problems with the install dir
>
> Yes, but the permissions issue here isn't the install directory - it is
> probably the TEMP directory or some other system restriction. It's
> basically impossible to tell from the logs, and I don't even know where to
> start asking for configuration settings to see what may be wrong.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-11 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Adding Serhiy and Nick who worked on these parts of CPython.

--
nosy: +Mariatta, ncoghlan, serhiy.storchaka
stage:  -> patch review

___
Python tracker 

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



[issue30871] Add a "python info" command somewhere to dump versions of all dependencies

2017-08-11 Thread Berker Peksag

Berker Peksag added the comment:

Two things:

1. I've just closed  PR 2618 as the scope of this issue is broader than my PR.
2. Could you also add version information of sqlite3?

--
nosy: +berker.peksag
stage:  -> patch review

___
Python tracker 

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



[issue30871] Add a "python info" command somewhere to dump versions of all dependencies

2017-08-11 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +3116

___
Python tracker 

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



[issue30849] test_stress_delivery_dependent() of test_signal randomly fails on AMD64 Debian root 3.6

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:

Oh, Zach's Gentoo buildbot was offline for a long time. Maybe it ran tests
on old commits? What about the first messages of this issue on the other
buildbot? Maybe it's also outdated? I am fine with closing the issue if you
fixed a bug in the meanwhile. Don't worry, I will reopen it if it comes
back :-D

--

___
Python tracker 

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



[issue30849] test_stress_delivery_dependent() of test_signal randomly fails on AMD64 Debian root 3.6

2017-08-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Victor, Zachary, 
http://buildbot.python.org/all/builders/x86%20Gentoo%20Non-Debug%20with%20X%203.x/builds/830
 corresponds to a very old changeset (more than one month old) before itimer() 
was fixed in 729780a810bbcb12b245a1b652302a601fc9f6fd.

--

___
Python tracker 

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



[issue31072] add filter to zipapp

2017-08-11 Thread Paul Moore

Paul Moore added the comment:

Sounds reasonable :-) I'm not going to be checking mails for a week or so, so 
I'll revisit this once I get back.

--

___
Python tracker 

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



[issue31072] add filter to zipapp

2017-08-11 Thread Brett Cannon

Brett Cannon added the comment:

What about simply 'filter' as a name? or 'path_filter'?

--
nosy: +brett.cannon

___
Python tracker 

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



[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-11 Thread George Collins

Changes by George Collins :


--
pull_requests: +3114

___
Python tracker 

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



[issue31143] lib2to3 requires source files for fixes

2017-08-11 Thread Brett Cannon

Brett Cannon added the comment:

You're technically right, Verdan, but pkgutils is kind of a hack as it isn't 
always using standard APIs to achieve its goals, so I personally never 
recommend using the module unless absolutely necessary and you know exactly how 
brittle it can be.

--

___
Python tracker 

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



[issue31185] Miscellaneous errors in asyncio speedup module

2017-08-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

They are occurred in very obscure cases like calling __init__ multiple times. 
The patch doesn't contain tests for them.

--

___
Python tracker 

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



[issue31185] Miscellaneous errors in asyncio speedup module

2017-08-11 Thread Yury Selivanov

Yury Selivanov added the comment:

> "reference leaks" oh? our Refleaks buildbots didn't catch them.

The test suite for Tasks and Futures is pretty extensive, but it obviously 
doesn't cover some obscure use cases.

+1 to make sure that any refleak that was discovered should have a new 
regression test for it.

--

___
Python tracker 

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



[issue31185] Miscellaneous errors in asyncio speedup module

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:

"reference leaks" oh? our Refleaks buildbots didn't catch them. Do your new 
tests reproduce the bugs, to make sure that we don't leak anymore?

--

___
Python tracker 

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



[issue31185] Miscellaneous errors in asyncio speedup module

2017-08-11 Thread Yury Selivanov

Yury Selivanov added the comment:

Huge thanks, Serhiy, btw.

--

___
Python tracker 

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



[issue31184] Fix data descriptor detection in inspect.getattr_static

2017-08-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue26103.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31185] Miscellaneous errors in asyncio speedup module

2017-08-11 Thread Yury Selivanov

Yury Selivanov added the comment:

Adding INADA, he is a co-author/reviewer of that code.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue31185] Miscellaneous errors in asyncio speedup module

2017-08-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +3113

___
Python tracker 

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



[issue31185] Miscellaneous errors in asyncio speedup module

2017-08-11 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch fixes miscellaneous errors in asyncio speedup module. It is hard 
to enumerate they all, but they are mostly NULL dereferencing, reference leaks, 
and handling exceptions in corner cases.

--
components: Extension Modules, asyncio
messages: 300171
nosy: giampaolo.rodola, haypo, serhiy.storchaka, yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: Miscellaneous errors in asyncio speedup module
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue31184] Fix data descriptor detection in inspect.getattr_static

2017-08-11 Thread David Halter

New submission from David Halter:

inspect.getattr_static is currently not identifying data descriptors the right 
way.

Data descriptors are defined by having a __get__ attribute and at least one of 
the __set__ and __delete__ attributes.

Implementation detail: Both __delete__ and __get__ set the same slot called 
tp_descr_set in CPython.

I have attached a patch that fixes the issue IMO.

--
files: 0001-Fix-data-descriptor-detection-in-inspect.getattr_sta.patch
keywords: patch
messages: 300170
nosy: davidhalter
priority: normal
severity: normal
status: open
title: Fix data descriptor detection in inspect.getattr_static
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: 
http://bugs.python.org/file47078/0001-Fix-data-descriptor-detection-in-inspect.getattr_sta.patch

___
Python tracker 

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



[issue30871] Add a "python info" command somewhere to dump versions of all dependencies

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:

Nir Soffer: "I like the idea, may be also useful in 
https://github.com/sosreport/sos/blob/master/sos/plugins/python.py;

It's hard to guess which kinds of informations are needed. My use case is to 
debug failing tests on the Python CIs. Other use cases may want other kinds of 
information.

For example, my perf module also a "python3 -m perf collect_metadata" which has 
a similar goal but reads also information about the CPU: CPU configuration, 
model, temperature, etc. I don't think that these information are useful for 
Python tests.


Serhiy Storchaka: "Note that there are two versions: the version with which the 
interpreter is build, and the version of the dynamic library."

Sorry, version of what? The readline module has two versions, my proposed 
test.pythoninfo tool saves both. Depending on the failing test, you need one 
version or the other, or both.

The purpose of pythoninfo is to be able to log a long list of informations, 
without after to care if it is useful or not in general ;-)

--

___
Python tracker 

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



[issue30871] Add a "python info" command somewhere to dump versions of all dependencies

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:

I wrote https://github.com/python/cpython/pull/3075 to add "python3 -m 
test.pythoninfo". I chose to add the script into Lib/test/ to notice users that 
it's design for Python internal usage, for Python tests.

I modified scripts running tests on our CI to also run pythoninfo, and then 
also started to cleanup ("simplify") the regrtest header (remove information 
rarely useful).

--

___
Python tracker 

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



[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-11 Thread George Collins

New submission from George Collins:

Issue 21947 informed the `dis` module about the `gi_code` attribute, which 
stores code objects for generator objects. This allows inspection of generator 
objects, not just functions which return them. However, asynchronous generator 
objects use `ag_code` and coroutine objects use `cr_code`, so dis raises a 
TypeError on them. I'm making a pull request to extend the generator behavior 
to async generators and coroutines.

Credit to Luciano Ramalho: I tripped over this at his (great) concurrency 
workshop at PyBay 2017 and he identified exactly what was happening and 
suggested a patch.

--
components: Extension Modules
messages: 300167
nosy: George Collins
priority: normal
severity: normal
status: open
title: `Dis` module doesn't know how to disassemble async generator or 
coroutine objects
type: enhancement
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue30871] Add a "python info" command somewhere to dump versions of all dependencies

2017-08-11 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3112

___
Python tracker 

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



[issue31067] test_subprocess.test_leak_fast_process_del_killed() fails randomly on AMD64 FreeBSD 10.x Shared 3.6

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:


New changeset f2d769d539279f01a6589dd3a0d5865dd00e13b0 by Victor Stinner in 
branch '3.6':
bpo-31067: test_subprocess calls reap_children() (#2931) (#3074)
https://github.com/python/cpython/commit/f2d769d539279f01a6589dd3a0d5865dd00e13b0


--

___
Python tracker 

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



[issue31067] test_subprocess.test_leak_fast_process_del_killed() fails randomly on AMD64 FreeBSD 10.x Shared 3.6

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 504939fdf4ebdff47aacfab7876754edeb57bbe1 by Victor Stinner in 
branch '2.7':
bpo-31067: test_subprocess calls reap_children() (#2931) (#3073)
https://github.com/python/cpython/commit/504939fdf4ebdff47aacfab7876754edeb57bbe1


--

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-11 Thread Yury Selivanov

Yury Selivanov added the comment:

> I like idea.
> One worrying point is how to deal with dirty dict.
> How about do it only when ma_used == keys->dk_nentries?

I've added this check.  See the updated PR.

> The PR changes the behavior. Currently the effect of copying is compacting 
> the dict.

The check that INADA suggested enables compacting on copy, if it is needed.

> The PR adds over 50 lines of code for optimising not very often used feature.

I started to look into the problem because I need this for my upcoming PEP, so 
please don't dismiss this idea right away.

I also think that copying a dict isn't a "not very often used feature", it 
depends on your frame of references.  In some applications you do copy dict a 
lot.  50 lines of code speeding up one of the core methods 5.5x is a fair price 
to pay.

> There are two obvious ways of copying, dict(d) and d.copy()

That can also be easily optimized, btw.  I'll see if I can do that without 
impacting the performance of creating new dicts.

> The PR duplicates the low-level code, that increases maintainability cost.

FWIW, the PR doesn't duplicate any of the code.  It provides a new 
implementation that is more efficient than the old approach.

--

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-11 Thread Yury Selivanov

Yury Selivanov added the comment:

> Why "del" doesn't compact the dict?

This is a good question, btw.

--

___
Python tracker 

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



[issue31067] test_subprocess.test_leak_fast_process_del_killed() fails randomly on AMD64 FreeBSD 10.x Shared 3.6

2017-08-11 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3111

___
Python tracker 

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



[issue31067] test_subprocess.test_leak_fast_process_del_killed() fails randomly on AMD64 FreeBSD 10.x Shared 3.6

2017-08-11 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +3110

___
Python tracker 

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



[issue31067] test_subprocess.test_leak_fast_process_del_killed() fails randomly on AMD64 FreeBSD 10.x Shared 3.6

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:

I tried and failed to reproduce the bug manually on the FreeBSD 10 buildbot.

I ran 14 iterations of "./python -m test test_subprocess -v -F 
--fail-env-changed" and 50 iterations of "./python -m test test_subprocess -m  
test_leak_fast_process_del_killed -F".

--

___
Python tracker 

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



[issue31173] test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie process

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 4dea06531ece28dffc1452de2694fb22e99b45f9 by Victor Stinner in 
branch '2.7':
bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055) (#3071)
https://github.com/python/cpython/commit/4dea06531ece28dffc1452de2694fb22e99b45f9


--

___
Python tracker 

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



[issue31173] test_subprocess: test_child_terminated_in_stopped_state() leaks a zombie process

2017-08-11 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue31072] add filter to zipapp

2017-08-11 Thread Paul Moore

Paul Moore added the comment:

Zipapp uses path objects throughout, so making the filter function take a path 
object is consistent with that. I guess modifying PyZipFile to take either a 
string or a path object would be possible.

As for the relative path, that's deliberate as I expect that a common use case 
will be to exclude a directory, and doing that via

lambda pth: pth.parts[0] != 'dir_to_exclude'

is a simple possibility. Having to do this with an absolute path would just 
require the user to make the path relative, and we've already done that in 
zipapp so why duplicate the work?

So I guess I'm saying I want to keep both those choices. Do you think this is a 
sufficient problem that we should *not* use the same name? Any suggestions on a 
better name (or should we stick with the original ``include_file``)?

--

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-11 Thread STINNER Victor

STINNER Victor added the comment:

 d = dict.fromkeys(range(2000))
 for i in range(1999): del d[i]
> ...
 sys.getsizeof(d)
> 41020
 sys.getsizeof(d.copy())
> 136

Why "del" doesn't compact the dict?

--

___
Python tracker 

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



[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Perhaps the check needs to be limited to just the exact type.

Looks reasonable to me. Do you want to provide a PR Martijn?

--
keywords: +easy (C)
nosy: +serhiy.storchaka
stage:  -> needs patch

___
Python tracker 

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



[issue31072] add filter to zipapp

2017-08-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are two differences between filterfunc arguments in zipapp and PyZipFile:

1. An argument of filterfunc is a string in PyZipFile and a Path object in 
zipapp.

2. The patch in zipapp is relative to the root of the archive. The patch in 
PyZipFile is a path on FS (absolute or relative to the current working 
directory).

I afraid that these differences can cause confusions.

--

___
Python tracker 

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



[issue31182] Suggested Enhancements to zipfile & tarfile command line interfaces

2017-08-11 Thread Steve Barnes

New submission from Steve Barnes:

I would like to add to the command line of both tarfile and zipfile interface 
some additional options that I believe to be useful.

1. Wildcard filename matching for archiving
2. Recursive archiving (with excludes)
3. Append to archive option
4. Compression Selection
 4.1 For zipfile: zip64, bizp2 & lzma (if available)
 4.2 For tarfile: document that gz, xz & bz2 are there and determined by ext.

--
components: Library (Lib)
messages: 300156
nosy: Steve Barnes
priority: normal
severity: normal
status: open
title: Suggested Enhancements to zipfile & tarfile command line interfaces
type: enhancement
versions: Python 2.7, Python 3.7

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +rhettinger

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The PR adds over 50 lines of code for optimising not very often used feature. 
There are two obvious ways of copying, dict(d) and d.copy(), the PR optimises 
just the latter one, and I'm not sure this is the most used way. The PR 
duplicates the low-level code, that increases maintainability cost.

The PR changes the behavior. Currently the effect of copying is compacting the 
dict.

>>> import sys
>>> sys.getsizeof(d)
41020
>>> sys.getsizeof(d.copy())
41020
>>> sys.getsizeof(dict(d))
41020
>>> for i in range(1000): del d[i]
... 
>>> sys.getsizeof(dict(d))
20544
>>> sys.getsizeof(d.copy())
20544
>>> sys.getsizeof(d)
41020
>>> import sys
>>> d = dict.fromkeys(range(2000))
>>> sys.getsizeof(d)
41020
>>> sys.getsizeof(d.copy())
41020
>>> d = dict.fromkeys(range(2000))
>>> for i in range(1999): del d[i]
... 
>>> sys.getsizeof(d)
41020
>>> sys.getsizeof(d.copy())
136

The PR preserves non compact layout in the copy.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28972] Document all "python -m" utilities

2017-08-11 Thread Steve Barnes

Steve Barnes added the comment:

Having done some checks for the practicality of auto documenting library items 
with a -m command line usage I have to say that it will not be so simple. 

Many of the library items that provide useful functionality, including zipfile 
& tarfile, are implemented as single .py files, rather than as modules so have 
no __main__.py to trigger the inclusion in auto-generated documentation. 

I also tried searching for standard library items that use `if __name__ == 
"__main__":` constructs but, of course, many files simply use that to expose 
tests rather than useful functionality - so that is out as well. I even thought 
of trying for a regex that would look for this followed, in the same scope by 
argparse but of course there is no obligation to use it.

And of course main() does not HAVE to be called main so that is out.

Sorry to scotch the idea Eric!

--
nosy: +Steve Barnes

___
Python tracker 

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



[issue31179] Speed-up dict.copy() up to 5.5 times.

2017-08-11 Thread INADA Naoki

INADA Naoki added the comment:

I like idea.
One worrying point is how to deal with dirty dict.
How about do it only when ma_used == keys->dk_nentries?

Slightly off topic. Copy on write can be implemented via dk_refcnt.
Functions just passing `**kwargs` has temporal copy of dict.
And CoW will reduce the cost of temporal dict.

--

___
Python tracker 

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