[issue30023] Example code becomes invalid for "Why do lambdas defined in a loop with different values all return the same result?"

2017-04-08 Thread Philip Lee
New submission from Philip Lee: There example code here becomes invalid https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result >>> squares = [] >>> for x in range(5): squares.append(lambda: x**2) >>> squa

[issue26860] Make os.walk and os.fwalk yield namedtuple instead of tuple

2017-04-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: I would expect that the field access time is inconsequential compared to just about every other aspect of os.walk(). -- ___ Python tracker _

[issue16572] Bad multi-inheritance support in some libs like threading or multiprocessing

2017-04-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm going to decline this suggestion. Antoine is right that this is a can of worms best less closed. Likewise, Richard pointed out that there is potential to break existing code. FWIW, the existence of super() does not imply that all existing classes need

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: I concur with the others. This is unnecessary feature creep that doesn't make sense for typical use cases. -- nosy: +rhettinger resolution: -> rejected stage: -> resolved status: open -> closed ___ Python track

[issue29944] Argumentless super() fails in classes constructed with type()

2017-04-08 Thread Dan Snider
Dan Snider added the comment: Just wanted to add that I found this when I was trying to find a way to decorate all methods in a class without using a metaclass or modifying __getattr__. Using Josh's workaround, here's a simple demonstration that (at least at first glance) prints a message wh

[issue23674] super() documentation isn't very clear

2017-04-08 Thread Martin Panter
Martin Panter added the comment: The magical no-argument call could also be clarified: 8. Define in the main text what happens when you omit the first argument (the subclass) to “super”. At the moment, I think the reader could infer that it is the method’s class, but this is only hinted by rea

[issue29944] Argumentless super() fails in classes constructed with type()

2017-04-08 Thread Martin Panter
Martin Panter added the comment: In Issue 23674, I posted a patch that changes to consistent parameter names (subclass, self). The exception message would avoid “type”, becoming super(subclass, self): self must be an instance or subtype of subclass -- nosy: +martin.panter

[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-04-08 Thread Mariatta Wijaya
Changes by Mariatta Wijaya : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue26860] Make os.walk and os.fwalk yield namedtuple instead of tuple

2017-04-08 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Should we have concerns about performances? Accessing a namedtuple value is almost 4x times slower compared to a plain tuple [1] and os.walk() may iterate hundreds of times. http://stackoverflow.com/questions/2646157/what-is-the-fastest-to-access-struct-lik

[issue30008] OpenSSL 1.1.0 deprecated functions

2017-04-08 Thread Mike Gilbert
Mike Gilbert added the comment: Thanks for the reply. OpenSSL 1.1.0 added functions to control the SSL/TLS version used by SSL contexts created using TLS_method(). You might consider updating the code for existing Python branches to use these functions. SSL_CTX_set_min_proto_version SSL_CTX_s

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I vote -1 too. 1. As was said, this doesn't work with all attribute names. 2. This adds circular dependency between operator and collections modules. 3. This increases memory consumption and startup time for small programs that don't use the collections modul

[issue30008] OpenSSL 1.1.0 deprecated functions

2017-04-08 Thread Christian Heimes
Christian Heimes added the comment: Thanks for your report. Python is going to require legacy functions like TLSv1_method() for a while. They are required to provide constants like PROTOCOL_TLSv1. I have deprecated these constants in 3.6 and they will be removed in 3.8. In the mean time Python

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Christian Heimes
Christian Heimes added the comment: I'm with RDM and vote -1, too. A namedtuple is a bit more costly than a normal tuple. That's especially try for dynamic attrgetter() that are defined ad-hoc, e.g. as key function for sorted(). The creation of type classes doesn't come for free. -- n

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread R. David Murray
R. David Murray added the comment: This is a clever idea, but I vote -1 for this proposal. I think it makes attrgetter more complex for little purpose. The fact that only some attribute names work and the others get mangled makes the API very ugly and not, IMO, desirable. Finally, if you wa

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

2017-04-08 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: For the sake of experiment I'm attaching a toy echo server which uses modify() to switch between EVENT_READ and EVENT_WRITE. Without patch I get 35000 req/sec, with patch around 39000 req/sec (11.4% faster). To be entirely honest a smarter echo server would

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

2017-04-08 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : Added file: http://bugs.python.org/file46793/echo_client.py ___ Python tracker ___ ___ Python-bugs-list mailing

[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-04-08 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: bump to close issue now that PR was merged -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker ___ _

[issue29963] Remove obsolete declaration PyTokenizer_RestoreEncoding in tokenizer.h

2017-04-08 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue29944] Argumentless super() fails in classes constructed with type()

2017-04-08 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Isaac Morland
Isaac Morland added the comment: What are the "other issues"? As to the issue you raise here, that's why I use rename=True. First create a type with an underscore attribute: >>> t = namedtuple ('t', ['a', '1234'], rename=True) (just an easy way of creating such a type; used of namedtuple spec

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Aside from other issues, namedtuples can't have fields beginning with underscores, attrgetter can get attributes beginning with underscores (and dotted attributes for that matter). There isn't going to be an obvious or intuitive mapping to apply here. ---

[issue19225] lack of PyExc_BufferError doc

2017-04-08 Thread KINEBUCHI Tomohiko
KINEBUCHI Tomohiko added the comment: Oh, I have overlooked these sentences. I will create an additional pull request to remove duplication. -- ___ Python tracker ___ ___

[issue29725] sqlite3.Cursor doesn't properly document "arraysize"

2017-04-08 Thread Berker Peksag
Berker Peksag added the comment: > row_factory seems to be another parameter that can be set in the Cursor > object. > https://github.com/python/cpython/blob/master/Modules/_sqlite/cursor.c#L65 > > This can addressed in a different issue/ pr. Like I already said in msg290943, Cursor.row_facto

[issue16572] Bad multi-inheritance support in some libs like threading or multiprocessing

2017-04-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: Multi-inheritance is tricky to get right, both for the class being extended and the class extending it. The APIs mentioned here were never designed for multiple inheritance and aren't supposed to support it. Your use case would probably be better served by us

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Isaac Morland
Isaac Morland added the comment: I've attached a file which illustrates what I'm proposing to happen with the examples from the help. Note that attrgetter (attr) is not affected, only attrgetter (*attrs) for more than one attribute. The idea is that tuples resulting from attrgetter functions

[issue16572] Bad multi-inheritance support in some libs like threading or multiprocessing

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue30006] Deadlocks in `concurrent.futures.ProcessPoolExecutor`

2017-04-08 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +bquinlan, davin, pitrou stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mail

[issue30022] Get rid of using EnvironmentError and IOError

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1203 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue30022] Get rid of using EnvironmentError and IOError

2017-04-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: EnvironmentError and IOError now are aliases to OSError. But some code still use them. Proposed patch replaces all uses of EnvironmentError and IOError (except tests and scripts) with OSError. This will make the code cleaner and more uniform. -- m

[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 1049 and PR 1050 restore ABI compatibility in 3.5 and 2.7. Unfortunately this restores the original bug with using PySlice_GetIndicesEx in third-party code (but CPython core and standard extensions no longer use PySlice_GetIndicesEx). Can we consider 3.6

[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1202 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1201 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8 by Serhiy Storchaka in branch 'master': Expand the PySlice_GetIndicesEx macro. (#1023) https://github.com/python/cpython/commit/b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8 New changeset c26b19d5c7aba51b50a4d

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset e41390aca51e4e3eb455cf3b70f5d656a2814db9 by Serhiy Storchaka in branch '2.7': bpo-27867: Expand the PySlice_GetIndicesEx macro. (#1023) (#1046) https://github.com/python/cpython/commit/e41390aca51e4e3eb455cf3b70f5d656a2814db9 -- _

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

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

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

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset e63f8f293a96ceebf06de15b4e1c97dbbff0f6a8 by Serhiy Storchaka in branch '3.5': bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) (#1043) https://github.com/python/cpython/commit/e63f8f293a96ceebf06de15b4e1c97dbbff0f

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

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset af685f9050416da8050e0ec11a8dff9afd4130e7 by Serhiy Storchaka in branch '3.6': bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) (#1042) https://github.com/python/cpython/commit/af685f9050416da8050e0ec11a8dff9afd413

[issue30021] Add examples for re.escape()

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1200 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue30021] Add examples for re.escape()

2017-04-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch adds examples of using re.escape(). See also issue29995. -- assignee: docs@python components: Documentation, Regular Expressions messages: 291326 nosy: docs@python, ezio.melotti, mrabarnett, serhiy.storchaka priority: normal severity:

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

2017-04-08 Thread Peter
Peter added the comment: OK, thanks. Given this is regarded as an enhancement rather than a bug fix, I understand the choice not to change this in Python 2.7. -- ___ Python tracker

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1198 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1197 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1199 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

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

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1196 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

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

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1195 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m