Georg Brandl added the comment:
HasAttr would just call GetAttr and discard the exception.
@ OP: what objects are you pickling? You can give them a __module__ attribute
to save the lookup in sys.modules.
--
nosy: +georg.brandl
___
Python tracker
Antoine Pitrou added the comment:
There's no doubt that whichmodule() has grown more complex since 3.2. We
probably cannot eliminate the O(number of modules) component, but could at
least make it faster.
--
stage: - needs patch
title: Creating the string representation of a module is
New submission from Paul Ianas:
The precondition for all the bisect functions is implemented like this:
if lo 0:
raise ValueError('lo must be non-negative')
if hi is None:
hi = len(a)
Now, of course, if hi is given, and hi = 2 * len(a), then we get an
IndexError. In
Antoine Pitrou added the comment:
Note the problem is easily reproduce. For example we can take numpy where some
ufuncs (i.e. function-like objects implemented in C) don't have a __module__.
$ PYTHONHASHSEED=0 python3.4 -m timeit -s import pickle, numpy; d=numpy.add
pickle.dumps(d)
1000
Georg Brandl added the comment:
Attached patch addresses the repeated __repr__ calling and gives a 4x speedup
here.
--
keywords: +patch
Added file: http://bugs.python.org/file36985/whichmodule_speedup.diff
___
Python tracker rep...@bugs.python.org
Antoine Pitrou added the comment:
Actually, numpy.add takes a different path. Sorry.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22676
___
Antoine Pitrou added the comment:
So, a proper way to reproduce it is through Ellipsis (which does go through
whichmodule()):
$ PYTHONHASHSEED=0 python3.4 -m timeit -s import pickle; d=Ellipsis
pickle.dumps(d)
1000 loops, best of 3: 201 usec per loop
--
STINNER Victor added the comment:
For example we can take numpy where some ufuncs (i.e. function-like objects
implemented in C) don't have a __module__.
Oh. I was not aware of that. Is there a way to fix numpy to set the __module__
attribute? Maybe we should warn users that serialiaing
STINNER Victor added the comment:
whichmodule_speedup.diff: I proposed once a more generic solution which is much
more complex to implement. Lazy formatting of Exception message: in most cases,
the message is not used. Replace AttributeError(message) with
AttributeError(attr=name), only
Antoine Pitrou added the comment:
Victor, see https://github.com/numpy/numpy/issues/4952
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22676
___
Antoine Pitrou added the comment:
Attached patch produces a 8x speedup on Ellipsis.
--
Added file: http://bugs.python.org/file36986/whichmodule.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22676
Georg Brandl added the comment:
I didn't have numpy anyway, I tested on a function with __module__ set to None
manually. But I see the same speedup for Ellipsis.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22676
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +rhettinger, tim.peters
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22683
___
___
Roundup Robot added the comment:
New changeset 6f6e56bb10aa by Antoine Pitrou in branch '2.7':
Issue #22660: update various mentions in the ssl module documentation.
https://hg.python.org/cpython/rev/6f6e56bb10aa
--
___
Python tracker
Changes by Antoine Pitrou pit...@free.fr:
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22660
___
Xavier de Gaye added the comment:
The attached patch adds the '-X' and '-Y' options to the regrtest tool,
allowing to select a range of tests and a range of their subtests. The patch
is missing the test cases for the moment.
Limitation:
Does not work very well with nested subtest (nested
New submission from Pas:
Please see the attached traceback (or this http://pastebin.com/WYinRGie for
fancy colors).
It depends on message size, we're trying to send Multipart MIME messages (a PDF
attached, that has an image embedded).
After editing flask_mail.py to use the fallback (
New submission from wabu:
using `p = create_subprocess_exec(..., stdout=subprocess.PIPE, limit=...)`,
p.stdout has not transport set, so the underlying protocol is unable to pause
the reading of the transport, resulting in high memory usage when slowly
consuming input from p.stdout, even if
R. David Murray added the comment:
It looks like a bug, but I'm not sure why as_bytes would trigger it but not
as_string.
Can you supply a copy of the message that fails? The as_string version
(assuming the content was all ascii) should be enough to reproduce the issue,
since it appears to
New submission from FH:
Upon inspection, random.randint(a,b) does not include the endpoint b, contrary
to documentation, and contrary to the argumentation in Issue7009.
To see this, run e.g.
sum(np.random.randint(0,1,1000))
which will return 0 repeatedly (statistically very unlikely). I tried
Mark Dickinson added the comment:
You seem to be confusing `np.random.randint`, which is a function from NumPy
(not part of core Python), with `random.randint` from the standard library.
NumPy's np.random.randint does not include the endpoint. Python's does. As
far as I can tell, the
STINNER Victor added the comment:
p = create_subprocess_exec(..., stdout=subprocess.PIPE, limit=...)
I don't see yield from. Do you wait until the coroutine completes?
See the documentation:
https://docs.python.org/dev/library/asyncio-subprocess.html#subprocess-using-streams
Please write a
New submission from Piotr Engelking:
Wrapping a paragraph containing a long word takes a lot of time:
$ time python3 -c 'import textwrap; textwrap.wrap(a * 2 ** 16)'
real3m14.923s
user3m14.792s
sys 0m0.016s
$
A straightforward replacement is 5000 times faster:
$ time python3 -c
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +georg.brandl, serhiy.storchaka
versions: +Python 3.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22687
___
New submission from Serhiy Storchaka:
There is a proposition (msg229163) to use the subprocess module instead of
os.popen() in the uuid module.
I hesitate how classify this issue (behavior, security or enhancement) and for
which versions target it. May be this is a dependency of issue17293.
Serhiy Storchaka added the comment:
This particular case is related to the behavior of the wordsep_re regular
expression in worst case. When text contains long sequence of words characters
which is not ended by a hypen, or long sequence of non-word and non-space
characters (and in some other
Ram Rachum added the comment:
Thanks for the fix Ethan. Will you also push this to the backport on PyPI?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
STINNER Victor added the comment:
Did you see my issue which has a patch?
http://bugs.python.org/issue22637
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22688
___
Ethan Furman added the comment:
Thanks for the reminder!
...
Done.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
___
Ram Rachum added the comment:
Thanks!
Two questions:
1. Is there a GitHub repo for enum34? Couldn't find a link to it on the PyPI
page.
2. Aren't 'name' and 'value' already included in `added_behavior`?
--
___
Python tracker
Ram Rachum added the comment:
Also, aren't you excluding a lot of important magic methods from that `dir`?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22506
___
Serhiy Storchaka added the comment:
Oh, I missed it. Thank you for opening the issue and writting the patch.
--
resolution: - duplicate
stage: needs patch - resolved
status: open - closed
superseder: - avoid using a shell in uuid: replce os.popen with
subprocess.Popen
Serhiy Storchaka added the comment:
Besides few nitpicks the patch LGTM.
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22637
___
wabu added the comment:
Sorry for the confusion, yes i do the yield from. The stdout stream for the
process is actually producing data as it should. The subprocess produces a high
amount of data (pbzip2), but is only consumed slowly.
Normally when the buffer limit is reached for a stream
Guido van Rossum added the comment:
Hm... It does look like there's nothing that tells stdout (which is a
StreamReader) about its transport. Wabu, could you experiment with a change
to asyncio/subprocess.py where SubprocessStreamProtocol.connection_made()
calls
Ethan Furman added the comment:
1. Is there a GitHub repo for enum34? Couldn't find a link to it on the PyPI
page.
The repo is at: https://bitbucket.org/stoneleaf/enum34
2. Aren't 'name' and 'value' already included in `added_behavior`?
They didn't used to be, but they are now. I'll
wabu added the comment:
Here's a more complete example
@coroutine
put_data(filename, queue, chunksize=16000):
pbzip2 = yield from asyncio.create_subprocess_exec(
'pbzip2', '-cd', filename,
stdout=asyncio.subprocess.PIPE, limit=self.chunksize*2)
while
Guido van Rossum added the comment:
Can you confirm that this patch fixes the problem (without you needing the
workaround in your own code)?
--
keywords: +patch
Added file: http://bugs.python.org/file36989/fix22685.patch
___
Python tracker
Roundup Robot added the comment:
New changeset 8ee63d0bd7b8 by Victor Stinner in branch 'default':
Issue #22637: avoid using a shell in uuid
https://hg.python.org/cpython/rev/8ee63d0bd7b8
--
nosy: +python-dev
___
Python tracker rep...@bugs.python.org
wabu added the comment:
thanks a lot, the fix works!
On 21.10.2014 22:16, Guido van Rossum wrote:
Guido van Rossum added the comment:
Can you confirm that this patch fixes the problem (without you needing the
workaround in your own code)?
--
keywords: +patch
Added file:
Roundup Robot added the comment:
New changeset 9038b63dad52 by Ethan Furman in branch 'default':
Issue22506: remove name value from __dir__ as they now show up automatically
https://hg.python.org/cpython/rev/9038b63dad52
--
___
Python tracker
Guido van Rossum added the comment:
Victor, do you think this needs a unittest? It seems kind of difficult to
test for whether memory fills up (the machine may get wedged if it does :-).
On Tue, Oct 21, 2014 at 1:39 PM, wabu rep...@bugs.python.org wrote:
wabu added the comment:
thanks a
STINNER Victor added the comment:
Oh ok, now I understood the issue :-)
Attached patch should fix it. It implements Guido's suggestion. There is not
unit test yet.
--
Added file: http://bugs.python.org/file36990/set_transport.patch
___
Python
New submission from Aidan Hobson Sayers:
Posix says the following on the subject of getenv:
The returned string pointer might be invalidated or the string content might
be overwritten by a subsequent call to getenv()
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/getenv.html)
STINNER Victor added the comment:
test_pause_reading.py: manual test for pause reading. It should pause reading
stdout pipe 4 times on UNIX.
--
Added file: http://bugs.python.org/file36991/test_pause_reading.py
___
Python tracker
STINNER Victor added the comment:
Ok, I just missed completly the Guido posted a patch before me... Maybe we
wrote the patch at the same time, I didn't refresh my browser :-)
Victor, do you think this needs a unittest? It seems kind of difficult to
test for whether memory fills up (the
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +haypo
versions: -Python 3.2, Python 3.3, Python 3.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22689
___
wabu added the comment:
On 21.10.2014 22:41, Guido van Rossum wrote:
Guido van Rossum added the comment:
Victor, do you think this needs a unittest? It seems kind of difficult to
test for whether memory fills up (the machine may get wedged if it does :-).
You could setup a the subprocess
Changes by Ben Roberts bjr.robe...@gmail.com:
--
nosy: +roippi
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22687
___
___
Python-bugs-list
Aidan Hobson Sayers added the comment:
In case it matters, I'm compiling using Emscripten which implements getenv like
so: https://github.com/kripken/emscripten/blob/1.25.2/src/library.js#L3323
(I personally think it's a bizarre way to do it, but technically I think it's
ok?)
--
Guido van Rossum added the comment:
Victor, your fix is identical to mine except for the variable names. I like
your version better. :-)
So now it's just about the unittest.
--
___
Python tracker rep...@bugs.python.org
New submission from Sigz:
I usually convert date string to time with strptime formating. I noticed
importing Gtk breaks strptime parsing for abbreviated month name and weekday
name :
import time
time.strptime(Mon, 20 Oct 2014 08:00:32 +, %a, %d %b %Y %H:%M:%S %z)
R. David Murray added the comment:
What locale are you using? Is it possible importing Gtk makes that locale
operative? (In which case, that would be a bug in either Gtk or its wrapper).
--
nosy: +r.david.murray
___
Python tracker
New submission from James:
Just the General Help that is in Python, doesn't really help. Here's what
would help, if every Module, had an example in code of how it was used instead
of the Trees. I mean, word trees, well that's what the writing reminds me of,
is word trees like you'd produce
James added the comment:
Just the General Help that is in Python, doesn't really help. Here's what
would help, if every Module, had an example in code of how it was used instead
of the Trees. I mean, word trees, well that's what the writing reminds me of,
is word trees like you'd produce in
55 matches
Mail list logo