[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Gareth Rees
Gareth Rees added the comment: The documentation says that weakref.Proxy objects are not hashable because this avoids a number of problems related to their fundamentally mutable nature, and prevent their use as dictionary keys. Hashable objects must be immutable, otherwise the hash might

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Still, weakref.ref objects are hashable, so I don't understand why weakref.proxy would be different. Hashability of weakref.ref has been added in 29aa832b8787, to support weak dictionaries. See issue403985. It simply wasn't discussed whether to also add

[issue24056] Expose closure generator status in function repr()

2015-04-28 Thread Mark Dickinson
Mark Dickinson added the comment: I can see that the `generator` information would be useful. What's the use-case for reporting that a function is a closure? I'm having trouble thinking of a case where it's useful to know that a function is a closure without also knowing which locals refer

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: So consider what happens if you forward the __hash__ method to the proxied object: the hash will change when the object dies. ref objects behave differently: they inherit their referent's hash value when alive, and remember it. proxy objects could be made

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: weakref.Proxy objects are not hashable regardless of the referent Interesting. @fdrake, do you remember why that is? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24067

[issue11205] Evaluation order of dictionary display is different from reference manual.

2015-04-28 Thread Steve Dougherty
Steve Dougherty added the comment: I've added a change to the bytecode magic number as well. I don't see a magic tag anymore, either in the code or for recent versions. There are autogenerated changes to Python/importlibs.h. Is my understanding correct that these are not to be committed?

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. added the comment: Clearly I've been away from this code for a long time. The hash support for ref objects is definitely a very special case, only intended to support WeakKeyDictionary. We that class implemented in C, we'd probably want the hash support for refs not to be

[issue23749] asyncio missing wrap_socket

2015-04-28 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov stage: - needs patch versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23749 ___

[issue24071] Python 2.7.8, 2.7.9 re.MULTILINE failure

2015-04-28 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - not a bug stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24071 ___

[issue24072] xml.etree.ElementTree.Element does not catch text

2015-04-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: What would you have it do in the general case, should it concatenate all the text in: root4 = ET.fromstring('aabcbdef/bghi/a') root4.text 'abc' If I'm interpreting the XML spec correctly ( http://www.w3.org/TR/2006/REC-xml-20060816/#sec-starttags

[issue24072] xml.etree.ElementTree.Element does not catch text

2015-04-28 Thread Jérôme Laurens
New submission from Jérôme Laurens: text is not catcher in case 3 below INPUT import xml.etree.ElementTree as ET root1 = ET.fromstring('aTEXT/a') print(root1.text) root2 = ET.fromstring('aTEXTb//a') print(root2.text) root3 = ET.fromstring('ab/TEXT/a') print(root3.text) CURRENT OUTPUT TEXT

[issue24072] xml.etree.ElementTree.Element does not catch text

2015-04-28 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- Removed message: http://bugs.python.org/msg242208 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24072 ___

[issue24072] xml.etree.ElementTree.Element does not catch text

2015-04-28 Thread Ned Deily
Ned Deily added the comment: While a bit confusing, I don't think this is a bug. Note the definition of the tail attribute of an element: If the element is created from an XML file the attribute will contain any text found after the element’s end tag and before the next tag. Unlike in root1

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. added the comment: I don't see any reason for proxy objects to be less hashable than ref objects. As for the p == p case, where the referent has expired, returning True if p is p seems acceptable (along with False inequalities, and True for other comparisons allowing

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Gareth Rees
Gareth Rees added the comment: I don't see any reason for proxy objects to be less hashable than ref objects. The difference is that unlike a ref object, a proxy object is supposed to forward its method calls to the proxied object. So consider what happens if you forward the __hash__ method

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Gareth Rees
Gareth Rees added the comment: Hashable is particularly misleading, because weakref.Proxy objects are not hashable regardless of the referent. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24067

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, PEP 205 explains it a bit more: the resulting proxy cannot be used as a dictionary key since it cannot be compared once the referent has expired, and comparability is necessary for dictionary keys. Operations on proxy objects after the referent dies cause

[issue24056] Expose closure generator status in function repr()

2015-04-28 Thread Berker Peksag
Berker Peksag added the comment: Here is a patch with a test. -- components: +Interpreter Core keywords: +patch nosy: +berker.peksag stage: needs patch - patch review Added file: http://bugs.python.org/file39224/issue24056.diff ___ Python tracker

[issue24072] xml.etree.ElementTree.Element does not catch text

2015-04-28 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- nosy: +eli.bendersky, scoder ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24072 ___

[issue2292] Missing *-unpacking generalizations

2015-04-28 Thread Neil Girdhar
Neil Girdhar added the comment: All tests pass. All reviewer comments addressed. Please let me know if anything else needs to be done from my end. -- Added file: http://bugs.python.org/file39230/starunpack42.diff ___ Python tracker

[issue24073] sys.stdin.mode can not give the right mode and os.fdopen does not check argument

2015-04-28 Thread Xiang Zhang
New submission from Xiang Zhang: The problem is what the title tells and can be produced by the snippet below. import sys import os sys.stdout.write(%s\n % sys.stdin.mode) sys.stdout.flush() f = os.fdopen(sys.stdin.fileno(), r) f.write() f.flush() f.read() f.close() When running this

[issue2292] Missing *-unpacking generalizations

2015-04-28 Thread Neil Girdhar
Neil Girdhar added the comment: Hi Steve: I have limited expertise in most of these areas, but I looked at starunpack40.diff and have these comments: * tests look to have good coverage of the feature (can't speak to coverage of the parser/compiler code) * parsermodule.c changes comprehension

[issue24069] Option to delete obsolete bytecode files

2015-04-28 Thread Sworddragon
New submission from Sworddragon: The library compileall has the option -f to force the rebuilding of the bytecode files so I thought maybe there could also be an option to delete all bytecode files which haven't a non-bytecode library anymore. -- components: Library (Lib) messages:

[issue17908] Unittest runner needs an option to call gc.collect() after each test

2015-04-28 Thread Guido van Rossum
Guido van Rossum added the comment: It's trivial to add to a single test or even a single TestCase subclass, yes. The use case is more that you have a ton of tests and you suspect there's a problem due to GC. Being able to call gc.collect() after each test through the flip of a flag would be

[issue19543] Add -3 warnings for codec convenience method changes

2015-04-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch that backports issue19619 and issue20404 with changing an exception to Py3k warning, and makes necessary changes in other modules and tests. $ ./python -3 Python 2.7.10rc0 (2.7:4234b0dd2a54+, Apr 28 2015, 16:51:51) [GCC 4.8.2] on linux2

[issue24068] statistics module - incorrect results with boolean input

2015-04-28 Thread Wolfgang Maier
Changes by Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de: Removed file: http://bugs.python.org/file39220/statistics._sum.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24068 ___

[issue24068] statistics module - incorrect results with boolean input

2015-04-28 Thread Wolfgang Maier
Changes by Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de: Added file: http://bugs.python.org/file39221/statistics._sum.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24068 ___

[issue24068] statistics module - incorrect results with boolean input

2015-04-28 Thread Wolfgang Maier
New submission from Wolfgang Maier: the mean function in the statistics module gives nonsensical results with boolean values in the input, e.g.: mean([True, True, False, False]) 0.25 mean([True, 1027]) 0.5 This is an issue with the module's internal _sum function that mean relies on.

[issue17908] Unittest runner needs an option to call gc.collect() after each test

2015-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: I still think that it's something that people can trivially implement and that has no place in the standard unittest package. -- versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org

[issue23749] asyncio missing wrap_socket

2015-04-28 Thread Elizabeth Myers
Elizabeth Myers added the comment: It seems pretty simple to just make a function that returns a new transport, something like transport = yield from loop.ssl_wrap_transport(transport). I'm not sure how to handle plaintext data left on the wire, though, unless that's not really a

[issue17908] Unittest runner needs an option to call gc.collect() after each test

2015-04-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue23839 where proposed not only call gc.collect(), but clear all caches in test.regrtest. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17908

[issue24070] Exceptions and arguments disappear when using argparse inside with statement

2015-04-28 Thread Roy Hyunjin Han
New submission from Roy Hyunjin Han: Exceptions and arguments disappear when using argparse inside a with statement. The behavior was confusing and frustrating because I could not pinpoint why certain arguments were missing or unrecognized. Unhandled exceptions inside the with statement

[issue23749] asyncio missing wrap_socket

2015-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Reading the source now (just woke up, sorry!), the new protocol thing makes sense Good :-) I'm not sure what to do with the waiter argument or how to handle that. I'm not sure. Apparently it's used for create_connection(), so perhaps it's not necessary

[issue11205] Evaluation order of dictionary display is different from reference manual.

2015-04-28 Thread Eric Snow
Eric Snow added the comment: Changes to importlib.h should always be committed. It is the frozen importlib._bootstrap module, which is the implementation of the import system used by the interpreter. So failure to commit changes to importlib.h means your changes to importlib._bootstrap will

[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2015-04-28 Thread Robert Collins
Robert Collins added the comment: Ah the user model? I think the following: If I run 'python -m unittest' in a directory, then I expect to run all of the tests contained within that directory tree, and no others. Does that definition help? --

[issue23749] asyncio missing wrap_socket

2015-04-28 Thread Elizabeth Myers
Elizabeth Myers added the comment: Reading the source now (just woke up, sorry!), the new protocol thing makes sense. I'm not sure what to do with the waiter argument or how to handle that. What I'm really trying to think of here is how to handle copying of state. I guess users will just have

[issue24070] Exceptions and arguments disappear when using argparse inside with statement

2015-04-28 Thread Benjamin Peterson
Benjamin Peterson added the comment: I'm not sure why this is so surprising. parse_args in __exit__ raises a SystmExit, which the Python interpreter takes to mean the program is responsibly exiting. I don't think any other behavior would be reasonable. e.g. sys.exit() in an except clause

[issue23058] argparse silently ignores arguments

2015-04-28 Thread Barry A. Warsaw
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23058 ___ ___ Python-bugs-list mailing

[issue23058] argparse silently ignores arguments

2015-04-28 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: Wouldn't it be safer all around if the subparsers took different arguments, or at least different namespace 'dest', than the main parser? IMHO, yes. I agree that the semantics of what the original code is trying to do is quite ambiguous. Since the

[issue23749] asyncio missing wrap_socket

2015-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: As for replacing the protocol but keeping the transport, what would be the semantics of that? The protocol is not really replaced, it's wrapped. Before: SocketTransport - UserProtocol After: SocketTransport - (asyncio.sslproto.SSLProtocol -

[issue23749] asyncio missing wrap_socket

2015-04-28 Thread Guido van Rossum
Guido van Rossum added the comment: That sounds like a good plan for the top-level APIs. But I think we may need to think about low-level APIs that handle Transports and Protocols as well. The design I had been thinking of does not do any socket-level manipulation (in fact it doesn't care if

[issue23749] asyncio missing wrap_socket

2015-04-28 Thread Guido van Rossum
Guido van Rossum added the comment: Looks like Antoine drew the same diagram but quicker. :-) Regarding the waiter arg, you can leave that None if you don't need it. It is intended to give the caller a way to block (using event loop machinery) until the connection is ready. But if your caller

[issue17908] Unittest runner needs an option to call gc.collect() after each test

2015-04-28 Thread Robert Collins
Robert Collins added the comment: I'm going to disagree with michael and antoine here. The *internals* should be clean and pluggable for sure, but this is actually a pretty common thing to try, so there's no reason to force it to only be done by external plugins. Right now the way to plug

[issue11205] Evaluation order of dictionary display is different from reference manual.

2015-04-28 Thread Steve Dougherty
Steve Dougherty added the comment: I've added the importlib.h changes and changed the name of the test to be more descriptive. -- Added file: http://bugs.python.org/file39228/issue11205-v3.patch ___ Python tracker rep...@bugs.python.org

[issue24066] send_message should take all the addresses in the To: header into account

2015-04-28 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- nosy: +barry, r.david.murray -ned.deily stage: - patch review versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24066 ___

[issue24066] send_message should take all the addresses in the To: header into account

2015-04-28 Thread Kirill Elagin
Kirill Elagin added the comment: x_x -- keywords: +patch Added file: http://bugs.python.org/file39219/multiple_to.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24066 ___

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Those methods are defined precisely so that they can be delegated. Since virtually anything can be proxied, the weakref.proxy *class* cannot tell upfront whether the proxied object will be an Iterator or not. I don't really see how to get around that.

[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2015-04-28 Thread Alex Shkop
Changes by Alex Shkop a.v.sh...@gmail.com: Added file: http://bugs.python.org/file39223/issue23882_find_one_level.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23882 ___

[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2015-04-28 Thread Alex Shkop
Alex Shkop added the comment: I'm still not sure which solution is the best. So I attach two simple patches. First one enables full recursive scan of start_dir for namespace packages. Second one loads tests only from top level namespace packages. -- keywords: +patch Added file:

[issue17620] Python interactive console doesn't use sys.stdin for input

2015-04-28 Thread Drekin
Drekin added the comment: Note that under status quo PyOS_Readline is called from two places: the tokenizer during an interactive session and the builtin function input. The tokenizer passes promptstring encoded in sys.stdin.encoding while input() passes promtstring encoded in

[issue18383] test_warnings modifies warnings.filters when running with -W default

2015-04-28 Thread Alex Shkop
Alex Shkop added the comment: *ping* -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18383 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Gareth Rees
Gareth Rees added the comment: Not just Iterator, but Container, Hashable, Iterable, and Sized too! import weakref class C: pass o = C() w = weakref.proxy(o) from collections.abc import * isinstance(w, Container) True isinstance(w, Hashable) True

[issue24071] Python 2.7.8, 2.7.9 re.MULTILINE failure

2015-04-28 Thread Stephen Evans
New submission from Stephen Evans: A simple multiline regex fails when just the re.MULTILINE argument is used, but works when equivalent alternative methods are used. This was tested on Python2.7.8 on FreeBSD and Win32 Python2.7.9 data = re.sub(r'#.*', '', text, re.MULTILINE) # fails data =

[issue24071] Python 2.7.8, 2.7.9 re.MULTILINE failure

2015-04-28 Thread Matthew Barnett
Matthew Barnett added the comment: The 4th argument of re.sub is the maximum count (0 means unlimited). help(re.sub) Help on function sub in module re: sub(pattern, repl, string, count=0, flags=0) Return the string obtained by replacing the leftmost non-overlapping occurrences of the

[issue23699] Add a macro to ease writing rich comparisons

2015-04-28 Thread Barry A. Warsaw
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23699 ___ ___ Python-bugs-list mailing

[issue24067] Weakproxy is an instance of collections.Iterator

2015-04-28 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. added the comment: ref objects behave differently: they inherit their referent's hash value when alive, and remember it. proxy objects could be made to behave the same way. They could, yes, but that would break the proxy behavior, and the hash -- equality behavior for