New submission from Seth Bromberger:
ipaddress.ip_address instances should be flyweight. There's really no reason to
make them mutable:
a = ipaddress.ip_address(10.1.2.3)
b = ipaddress.ip_address(10.1.2.3)
id(a)
140066533772368
id(b)
140066504622544
Especially with IPv6 and large numbers
Seth Bromberger added the comment:
Confirmed on 3.4.0; likely exists in previous versions as well.
--
versions: +Python 3.4 -Python 3.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23103
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +ncoghlan, pmoody
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23103
___
___
Changaco added the comment:
honcho has been affected by this:
https://github.com/nickstenning/honcho/issues/122
Working around the problem is possible but not very pretty:
https://github.com/nickstenning/honcho/pull/121
--
nosy: +Changaco
___
Changaco added the comment:
The broken patch made it into the 2.7.9 release, causing argparse to silently
ignore arguments, cf http://bugs.python.org/issue23058
--
nosy: +Changaco
___
Python tracker rep...@bugs.python.org
New submission from Андрей Парамонов:
To reproduce:
0) Compile attached testlib.c
1) Run the following code:
from __future__ import print_function
from __future__ import unicode_literals
from ctypes import *
testlib = windll.LoadLibrary('testlib')
testfun = testlib.test
class
Josh Rosenberg added the comment:
What is your proposal? WeakValueDictionary mapping raw bytes object to single
instance of ipaddress that is queried from ipaddress's __new__? No built-in has
quite that extensive a level of caching and aggressive deduplication to my
knowledge.
--
Seth Bromberger added the comment:
What is your proposal? WeakValueDictionary mapping raw bytes object to single
instance of ipaddress that is queried from ipaddress's __new__? No built-in
has quite that extensive a level of caching and aggressive deduplication to my
knowledge.
I was
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23102
___
Donald Stufft added the comment:
This should be fixed now as of https://hg.python.org/cpython/rev/651e1862dbed,
https://hg.python.org/cpython/rev/651e1862dbed, and
https://hg.python.org/cpython/rev/9f60d024e586.
--
resolution: - fixed
status: open - closed
Roundup Robot added the comment:
New changeset edf669b13482 by Serhiy Storchaka in branch 'default':
Issue #21793: Added http.HTTPStatus enums (i.e. HTTPStatus.OK,
https://hg.python.org/cpython/rev/edf669b13482
--
nosy: +python-dev
___
Python tracker
Serhiy Storchaka added the comment:
Thank you for your contribution Demian.
--
resolution: - fixed
stage: commit review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21793
New submission from Sworddragon:
From the documentation:
os.O_DSYNC
os.O_RSYNC
os.O_SYNC
os.O_NDELAY
os.O_NONBLOCK
os.O_NOCTTY
os.O_SHLOCK
os.O_EXLOCK
os.O_CLOEXEC
These constants are only available on Unix.
But os.O_SHLOCK and os.O_EXLOCK are not available on my system (Linux
Changes by Sworddragon sworddrag...@aol.com:
--
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23105
___
___
Python-bugs-list
Changes by Sworddragon sworddrag...@aol.com:
--
components: +Library (Lib)
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23105
___
___
Serhiy Storchaka added the comment:
IP address instances already are immutable and flyweight. There are no mutating
methods. And a number of address attributes (packed, is_loopback, etc) are
calculated on fly from integer representation.
But IP address objects can be lighter.
1) Use
Changes by R. David Murray rdmur...@bitdance.com:
--
nosy: +r.david.murray
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23103
___
___
R. David Murray added the comment:
The documentation says Some of them are not available on all platforms. For
descriptions of their availability and use, consult the open(2) manual page on
Unix or the MSDN on Windows.. The important bit there being consult the
open(2) manual page on Unix
Sworddragon added the comment:
I have missed the first part of the documentation and am not sure if something
needs really to be changed. But if you think so maybe comments like These
constants are only available on Unix. could be extended by the word commonly
like These constants are
Seth Bromberger added the comment:
1) However:
b = ipaddress.IPv4Address('1.2.3.4')
a = ipaddress.IPv4Address('1.2.3.4')
id(a)
4428380928
id(b)
4428381768
a == b
True
b._ip += 6
id(b)
4428381768
b
IPv4Address('1.2.3.10')
2) Isn’t _version already a class attribute? It’s set in
Julien Palard added the comment:
Works for me in 2.7.8:
$ python --version
Python 2.7.8
# cat /tmp/test.py
#!/usr/bin/env python
from __future__ import print_function
def toto():
print (42, 43)
42 43
return 42
$ python -m doctest -v /tmp/test.py
Trying:
print (42,
Demian Brecht added the comment:
@Julien.Palard: There's a subtle difference between your test and the issue as
written. Your test lives within a module and therefore executes testmodule (see
https://hg.python.org/cpython/file/9f60d024e586/Lib/doctest.py#l1819) whereas
the issue reported uses
Demian Brecht added the comment:
it's been resolved in 3.5
Sorry, that statement can be a little misleading, possibly indicating that
something may have changed in the doctest globals handling. It was resolved in
3.5 because print is no longer a statement so this ambiguous behaviour resolved
R. David Murray added the comment:
If ipaddress objects are already immutable, it seems to me that having a
registry that makes it so there is only one instance per ip value isn't a crazy
idea. I've written such code in other contexts and it's not complicated. We
have caching of identifier
Seth Bromberger added the comment:
The opposite argument is that it may be better left up to the application that
has to handle lots of ips to do the caching according to what it knows to be
an optimum pattern.
I'd agree with you wholeheartedly if ipaddress wasn't part of stdlib, but the
Changes by Jakub Wilk jw...@jwilk.net:
--
nosy: +jwilk
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22350
___
___
Python-bugs-list mailing list
Terry J. Reedy added the comment:
test_venv passed on Open Indiana in the 14:10-14:22 buildbot runs triggered by
the patch. It failed with a different error on a later default run, but that
looked like a different issue, if permanent.
--
___
Donald Stufft added the comment:
I'm not sure how to get a link to that, can you link it and I can see if I
think it's a permanent error or not?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22669
Terry J. Reedy added the comment:
http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/9012/steps/test/logs/stdio
Start with buildbot.python.org, select set of (all/stable) buildbots for
version. 'Build ' like gives commit(s) that triggered build. Test stdio
link, as
Raymond Hettinger added the comment:
Adding __slots__ is reasonable.
Adding caching to fold together repeated addresses is dubious (it comes with
its own space and time cost but won't benefit all users) and, as David said,
the decision on how to handle this is up to the user. Also, it is
Josh Rosenberg added the comment:
So, just to be clear, checking the implementation (as of 3.4):
1. All the ipaddress classes leave __slots__ unset. So the overhead is actually
higher than 56 bytes per instance; the __dict__ for an IPv4Address (ignoring
the actual keys and values in the dict,
Raymond Hettinger added the comment:
Procedural question ... is a fix for this considered an enhancement?
Improvements to documentation are almost always backported. The contrasts with
code changes where enhancements (new features, optimizations, or refactorings)
are made only on the latest
Marc-Andre Lemburg added the comment:
Josh, you might want to have a look at the lightning talk on this page and the
associated slides...
http://www.egenix.com/library/presentations/PyCon-UK-2014-When-performance-matters/
After having done the tests, using __slots__ is what I consider the
Raymond Hettinger added the comment:
I would argue this is a good time to clean up that code in the standard
library.
Please leave any clean-ups to the module maintainers. PEP 8 is something you
should do to your own code, rather than something you inflict on other people's
code.
We
Seth Bromberger added the comment:
As a test, I tried the following (taken mostly from
http://codesnipers.com/?q=python-flyweights):
class Foo(object):
_Foo = weakref.WeakValueDictionary()
def __new__(cls, addr):
obj = Foo._Foo.get(addr, None)
if obj is None:
Seth Bromberger added the comment:
Sorry for the additional followup, but I re-ran the test with approximately
real-world parameters. In this second test, I created 10 million Foo()
instances with random values from 1-2000 (using random.randint). This
corresponds to 2000 hosts generating 10
New submission from Raymond Hettinger:
This tracker item is here to record my efforts to re-evaluate whether we were
getting much if any benefit from the smalltable in set objects.
Removing the smalltable special case and instead using a memory allocation had
the following effects:
* Nice
Josh Rosenberg added the comment:
Marc-Andre: Oh, I know. I proselytize to coworkers on the virtues of using
__slots__ for classes that will have many instances created (particularly since
entirely too much of our stuff is still Py2.7, so we don't have the free
savings from shared key
Seth Bromberger added the comment:
I'm just pointing out that if he thinks 56 bytes per object is too large, he's
going to be disappointed with what Python has to offer. General purpose
user-defined Python objects don't optimize for low memory usage, and even
__slots__ only gets you so far.
John Posner added the comment:
issue21279.v5.patch tries to apply the comments in msg233013, msg233014, and
msg233025 to the Doc/library/stdtypes.rst writeup. Then it applies some of the
same language to the docstring in Objects/unicodeobject.c.
--
Added file:
Changes by Gustavo Temple gustavo.pedr...@eldorado.org.br:
--
nosy: +steve.dower
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23089
___
___
Changes by Gustavo Temple gustavo.pedr...@eldorado.org.br:
--
nosy: +lemburg
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23089
___
___
Changes by Gustavo Temple gustavo.pedr...@eldorado.org.br:
--
nosy: +meador.inge
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23089
___
___
Changes by Gustavo Temple gustavo.pedr...@eldorado.org.br:
--
nosy: +tim.golden
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23089
___
___
Changes by Gustavo Temple gustavo.pedr...@eldorado.org.br:
--
nosy: +zach.ware
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23089
___
___
Zachary Ware added the comment:
Not sure why I was added here, but...
I agree with David, we need to see the python-dev discussion to its finish
before we make any more changes to any of our private copies of libffi. I hope
to get some experimental results from Windows written up and posted
New submission from Raymond Hettinger:
The lookkey functions currently check for an exact key match in the inner
search-loop. Move that test to occur after a matching hash is found rather
than testing every entry. This gives a modest speed improvement.
--- n = 10,000 ---
$
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
Added file: http://bugs.python.org/file37538/time_tight.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23107
___
48 matches
Mail list logo