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
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
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
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
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
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?
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
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
___
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
___
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
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
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
___
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
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
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
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
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
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
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
nosy: +eli.bendersky, scoder
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24072
___
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
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
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
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:
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
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
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
___
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
___
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.
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
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
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
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
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
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
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?
--
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
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
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
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
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
-
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
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
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
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
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
___
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
___
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.
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
___
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:
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
Alex Shkop added the comment:
*ping*
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18383
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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 =
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
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
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
56 matches
Mail list logo