[issue14758] SMTPServer of smptd does not support binding to an IPv6 address

2012-05-09 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Unfortunately unit tests overwrite the original smtpd.socket module object with 
test.mock_socket [1] and the latter one doesn't expose socket.getaddrinfo().

[1] http://hg.python.org/cpython/file/d937b527b76e/Lib/test/test_smtpd.py#l54

--

___
Python tracker 
<http://bugs.python.org/issue14758>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14758] SMTPServer of smptd does not support binding to an IPv6 address

2012-05-08 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Agreed. The only problem I see is that unit tests rely on a mock socket object 
and should be rewritten by using an actual socket.

--

___
Python tracker 
<http://bugs.python.org/issue14758>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13903] New shared-keys dictionary implementation

2012-04-24 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy:  -giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12184] socketserver.ForkingMixin collect_children routine needs to collect only it's children

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue12184>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1767511] SocketServer.DatagramRequestHandler

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue1767511>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5824] SocketServer.DatagramRequestHandler Broken under Linux

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue5824>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13749] socketserver can't stop

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13749>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14386] Expose dictproxy as a public type

2012-03-27 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14386>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-23 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

http://hg.python.org/cpython/rev/0b960e41e533
Let's see how it goes.

--

___
Python tracker 
<http://bugs.python.org/issue10340>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-23 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Sorry about that. It should now be fixed.

--

___
Python tracker 
<http://bugs.python.org/issue10340>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-22 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
assignee:  -> giampaolo.rodola
priority: high -> normal
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue10340>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13325] no address in the representation of asyncore dispatcher after connection established

2012-03-22 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Closing as duplicate of issue 13694.

--
resolution:  -> duplicate
status: open -> closed
versions: +Python 2.7

___
Python tracker 
<http://bugs.python.org/issue13325>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14373] C implementation of functools.lru_cache

2012-03-20 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14373>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11273] asyncore creates selec (or poll) on every iteration

2012-03-20 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

I agree it would be great to do this, in fact I'm using a modified version of 
asyncore supporting register(), unregister() and modify() methods for file 
descriptors, and the performance benefits are enormous.

On the other hand, it appears to be quite difficult to integrate such a massive 
change into asyncore in a fully backward compatible manner. At least, it's not 
clear to me how to do this without breaking code relying on map's parameter and 
asyncore.socket_map.

--

___
Python tracker 
<http://bugs.python.org/issue11273>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14375] Add socketserver running property

2012-03-20 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
keywords: +needs review -patch

___
Python tracker 
<http://bugs.python.org/issue14375>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14375] Add socketserver running property

2012-03-20 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
title: Add socketserver.running property -> Add socketserver running property

___
Python tracker 
<http://bugs.python.org/issue14375>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14375] Add socketserver.running property

2012-03-20 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :

Patch in attachment adds a "running" property to figure out whether the server 
is running or not.

Also it raises an exception in case the server has already been started or 
stopped. IMO such an event should be prevented beforehand as it signals an 
application error.

Finally, __repr__ has been modified in order to reflect the current server 
status.

--
files: socketserver.patch
keywords: patch
messages: 156432
nosy: giampaolo.rodola, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Add socketserver.running property
versions: Python 3.3
Added file: http://bugs.python.org/file24970/socketserver.patch

___
Python tracker 
<http://bugs.python.org/issue14375>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13694] asynchronous connect in asyncore.dispatcher does not set addr

2012-03-20 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Done. Sorry for the delay.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue13694>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14370] list.extend() called on an iterator of the list itself leads to an infinite loop

2012-03-20 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14370>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14302] Move python.exe to bin/

2012-03-20 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14302>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14320] set.add can return boolean indicate newly added item

2012-03-16 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14320>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14310] Socket duplication for windows

2012-03-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14310>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14295] PEP 417: adding mock module

2012-03-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14295>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14309] Deprecate time.clock()

2012-03-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14309>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14307] Make subclassing SocketServer simpler for non-blocking frameworks

2012-03-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14307>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7978] SocketServer doesn't handle syscall interruption

2012-03-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue7978>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13248] deprecated in 3.2, should be removed in 3.3

2012-03-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13248>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14139] test_ftplib: segfault

2012-03-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14139>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14170] print unicode string error in win8 cmd console

2012-03-02 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue14170>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12655] Expose sched.h functions

2012-02-17 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue12655>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

2012-02-13 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13997>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13972] set and frozenset constructors don't accept multiple iterables

2012-02-09 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13972>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13968>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-02-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13742>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13578] Add subprocess.iter_output() convenience function

2012-02-06 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

> This biggest challenge I have noticed so far in exploring 
> this is how to handle timeouts on Windows

I haven't actually looked into it but this somewhat recalls:
http://bugs.python.org/issue1191964
Since issue1191964 is supposed to provide async subprocess I/O I presume 
Windows timeouts are also involved somewhere in the provided patch/recipe.

--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13578>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13928] bug in asyncore.dispatcher_with_send

2012-02-06 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

No problem.

--

___
Python tracker 
<http://bugs.python.org/issue13928>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13928] bug in asyncore.dispatcher_with_send

2012-02-04 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

> i can't understand this, does it means that one may use 
> self.connect() in handle_write()? 

Nope. When handle_write() is called you are supposed to be *already* connected, 
hence there's no point in calling connect() again. 
This is clear if you look at handle_write_event method or read asyncore doc.



> "If it shows up in the writable list, you have a decent 
> "chance that it has connected."
> from the latter paragraph may i assume that a writable 
> socket should always has been connected?

Nope. It means that *before* showing up the socket was *not* connected.


> if we call dispatcher.send() immediately after .connect(), 
> socket error 10057 may be raised",

Of course it does: you're not connected yet (10057 = WSAENOTCONN). 
You're supposed to use send() in handle_connect(), when the connection has 
already been established.
This:

 self.connect()
 self.send('hello')

...is not asyncore is supposed to be used.

--

___
Python tracker 
<http://bugs.python.org/issue13928>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13928] bug in asyncore.dispatcher_with_send

2012-02-03 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

> why is a not connected connection writable? 

A non connected socket must be writable in order to connect.

> if we call dispatcher.connect() immediately after .connect(), 
> socket error 10057 may be raised, 

Not sure what you mean here. Why would you call connect() twice?

--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13928>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13903] New shared-keys dictionary implementation

2012-01-29 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13846] Add time.monotonic() function

2012-01-24 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13846>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13609] Add "os.get_terminal_size()" function

2012-01-21 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

> read environment varaiables [...] and raise an error if the size cannot be
> read (so no need of default values). The os module is written as a thin
> wrapper between Python and the OS. A more high level function (read 
> environment variables, handle the error, use a namedtuple) can be written in 
> your application, or maybe in another module.

+1. I also find weird that a function, especially one living in the os module, 
has such a high level of abstraction (basically this is why I was originally 
proposing shutil module for this to go in).

Given the different opinions about the API, I think it's best to expose the 
lowest level functionality as-is, and let the user decide what to do (read env 
vars first, suppress the exception, use a fallback, etc.). 


> I think we have reached the point where we won't be in total 
> agreement over the API, so let's choose whatever is submitted 
> as a patch.

I'd be more careful. Once this gets in it will be too late for a change.

--

___
Python tracker 
<http://bugs.python.org/issue13609>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13822] is(upper/lower/title) are not exactly correct

2012-01-20 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13822>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13752] add a str.casefold() method

2012-01-19 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13752>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13761] Add flush keyword to print()

2012-01-11 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13761>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13724] socket.create_connection and multiple IP addresses

2012-01-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13724>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13714] Methods of ftplib never ends if the ip address changes

2012-01-05 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Python can't do that. It's a socket implementation detail. Python just exposes 
the underlying socket implementation as-is.
I'm closing this out as rejected.

--
assignee:  -> giampaolo.rodola
resolution:  -> rejected
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue13714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13714] Methods of ftplib never ends if the ip address changes

2012-01-05 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Since you say the connection hangs I think you can set a timeout:

>>> ftp = ftplib.FTP(..., timeout=30)

That is applied to both control and data connection (and hence storbinary). 
This way you should get a socket.timeout exception after 30 seconds.

--

___
Python tracker 
<http://bugs.python.org/issue13714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13714] Methods of ftplib never ends if the ip address changes

2012-01-05 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

What storbinary does is just using a socket to send data.
There's no way for storbinary to ask the socket whether an unpredicted event 
such as an IP change occurred and neither it should.

As a user, you just shouldn't change the IP address while a network app is 
running on that network interface and expect it to keep working or raise an 
exception.  
The consequences are unpredictable and are probably subject to change depending 
on what platform you're on.

In summary, this is not a problem which should be dealt with by base ftplib or 
any other network lib in the stdlib.

--

___
Python tracker 
<http://bugs.python.org/issue13714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13714] Methods of ftplib never ends if the ip address changes

2012-01-05 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

It seems expected behavior to me, and the same issue should apply to all other 
network libs as well. What would you expect ftplib to do in such case?

--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13714>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13609] Add "os.get_terminal_size()" function

2012-01-02 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

What I would do:

- build the namedtuple in Python rather than in C
- I don't particularly like CamelCased names for nametuples (I would use "size" 
instead of "TerminalSize")
- on UNIX, the ioctl() stuff can be done in python rather than in C
- use C only on Windows to deal with GetStdHandle/GetConsoleScreenBufferInfo; 
function name should be accessed as nt._get_terminal_size similarly to what we 
did for shutil.disk_usage in issue12442.
- do not raise NotImplementedError; if the required underlying functions are 
not available os.get_terminal_size should not exists in the first place (same 
as we did for shutil.disk_usage / issue12442)


Also, I'm not sure I like fallback=(80, 25) as default, followed by:

try:
size = query_terminal_size(sys.__stdout__.fileno())
except OSError:
size = TerminalSize(fallback)

That means we're never going to get an exception.
Instead I would:
- provide fallback as None
- let OSError propate unless fallback is not None

--

___
Python tracker 
<http://bugs.python.org/issue13609>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13694] asynchronous connect in asyncore.dispatcher does not set addr

2012-01-02 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

I'm not sure how useful this is as addr will be set later, when connection is 
established.

--

___
Python tracker 
<http://bugs.python.org/issue13694>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8684] improvements to sched.py

2011-12-19 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

This should now be fixed. Thanks for signaling.

--
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue8684>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13609] Add "os.get_terminal_size()" function

2011-12-16 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

> The docstring for shutil says: Utility functions for copying and 
> archiving files and directory trees. So it doesn't seem to fit at all.

Well... shutil should stand for "shell utilities" and it already contains stuff 
which is not strictly related to file/directory direct operations (see 
shutil.disk_usage and upcoming shutil.which).

But maybe you're right... I don't know...
My point is that a function which attempts different fallbacks (ask OS -> ask 
os.environ -> return (None, None) / raise exception) sounds more like an 
utility function rather than something belonging to os module, where you 
tipically see 1-to-1 interfaces for the underlying system functions.

--

___
Python tracker 
<http://bugs.python.org/issue13609>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13229] Improve tools for iterating over filesystem directories

2011-12-16 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13229>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12809] Missing new setsockopts in Linux (eg: IP_TRANSPARENT)

2011-12-16 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue12809>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13609] Add "os.get_terminal_size()" function

2011-12-16 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Plus, you should provide also heigth, not only width, possibly as a namedtuple:

>>> import shutil
>>> shutil.get_terminal_size()
size(width=80, heigth=170)
>>>

--

___
Python tracker 
<http://bugs.python.org/issue13609>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13041] argparse: terminal width is not detected properly

2011-12-16 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
dependencies: +Add "os.get_terminal_size()" function
versions:  -Python 2.7, Python 3.2

___
Python tracker 
<http://bugs.python.org/issue13041>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13609] Add "os.get_terminal_size()" function

2011-12-16 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

http://bugs.python.org/file23241/patch1.1.diff
This looks like something which would fit better into shutil module rather than 
os.
Also, the Windows implementation should not rely on ctypes.

--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13609>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10017] pprint.pprint raises TypeError on dictionaries with user-defined types as keys

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue10017>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10592] pprint module doesn't work well with OrderedDicts

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue10592>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13004] pprint: add option to truncate sequences

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13004>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6743] Add function compatible with print to pprint module

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue6743>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7434] general pprint rewrite

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue7434>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue5131>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-12-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue12082>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1641] asyncore delayed calls feature

2011-12-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Now that I think of it maybe some kind of wrapper would still be necessary.
As of right now, we'd do something like this.
At the core we would have:

import asyncore, asynchat, sched

# global
scheduler = sched.scheduler()

while 1:
asyncore.loop(timeout=1.0, count=1)  # count=1 makes loop() return after 1 
loop
scheduler.run(blocking=False)   


Then, every dispatcher can define a scheduled function of its own:


class Client(asynchat.async_chat):
# an already connected client 
# (the "connector" code is not included in this example)

def __init__(self, *args, **kwargs):
asynchat.async_chat.__init__(self, *args, **kwargs)
self.set_terminator("\r\n")
self.set_timeout()

def set_timeout(self):
self.timeout = scheduler.enter(30, 0, self.handle_timeout)

def reset_timeout(self):
scheduler.cancel(self.timeout)
self.set_timeout()

def found_terminator(self):
scheduler.cancel(self.timeout)
self.timeout = scheduler.enter(30, 0, self.handle_timeout)
# do something with the received data...

def handle_timeout(self):
self.push("400 connection timed out\r\n")
self.close()

def close(self):
scheduler.cancel(self.timeout)
asynchat.async_chat.close(self)

--

___
Python tracker 
<http://bugs.python.org/issue1641>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13449] sched - provide an "async" argument for run() method

2011-12-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +josiah.carlson, josiahcarlson

___
Python tracker 
<http://bugs.python.org/issue13449>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13449] sched - provide an "async" argument for run() method

2011-12-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
assignee:  -> giampaolo.rodola
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue13449>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1641] asyncore delayed calls feature

2011-12-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

With issue13449 fixed I think we can now provide this functionnality by adding 
a specific section into asyncore doc which explains how to use asyncore in 
conjunction with sched module.
As such, asyncore.py itself won't need any change.

--

___
Python tracker 
<http://bugs.python.org/issue1641>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13449] sched - provide an "async" argument for run() method

2011-12-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

"blocking" seems the most explicit to me.
With this, we can also fix issue1641 by providing a specific section into 
asyncore doc which explains how to use asyncore in conjunction with sched.

--

___
Python tracker 
<http://bugs.python.org/issue13449>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13449] sched - provide an "async" argument for run() method

2011-12-14 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

What about run(nowait=...) or run(only_ready=...)?
Doing this as a separate method seems unnecessarily complicated to me in terms 
of implementation (move run logic into _run, add "run" and "run_nowait", 
etc...).
Most importantly, the user will have to remember two methods which are 
basically equivalent in terms of "what they actually do".

--

___
Python tracker 
<http://bugs.python.org/issue13449>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8684] improvements to sched.py

2011-12-14 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue8684>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11647] function decorated with a context manager can only be invoked once

2011-12-12 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue11647>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13585] Add contextlib.CleanupManager

2011-12-12 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13585>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13451] sched.py: speedup cancel() method

2011-12-12 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Thread locks introduced in issue8684 should make this change more robust.
If this patch is reasonable, I'd like to commit it before the one in issue8684 
for simplicity.
Raymond?

--

___
Python tracker 
<http://bugs.python.org/issue13451>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8684] improvements to sched.py

2011-12-12 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

New patch in attachment. I'll commit it later today.

--
nosy: +rhettinger
Added file: http://bugs.python.org/file23925/sched-thread-safe.patch

___
Python tracker 
<http://bugs.python.org/issue8684>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8684] improvements to sched.py

2011-12-12 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

This is what I get by using bench.py script attached to issue13451:

CURRENT VERSION (NO LOCK)

test_cancel: time=0.67457 : calls=1 : stdev=0.0
test_empty : time=0.00025 : calls=1 : stdev=0.0
test_enter : time=0.00302 : calls=1 : stdev=0.0
test_queue : time=6.31787 : calls=1 : stdev=0.0
test_run   : time=0.00741 : calls=1 : stdev=0.0


LOCK WITH DECORATOR (no synchronization)

test_cancel: time=0.70455 : calls=1 : stdev=0.0
test_empty : time=0.00050 : calls=1 : stdev=0.0
test_enter : time=0.00405 : calls=1 : stdev=0.0
test_queue : time=6.23341 : calls=1 : stdev=0.0
test_run   : time=0.00776 : calls=1 : stdev=0.0


LOCK WITHOUT DECORATOR (always synchronized)

test_cancel: time=0.69625 : calls=1 : stdev=0.0
test_empty : time=0.00053 : calls=1 : stdev=0.0
test_enter : time=0.00397 : calls=1 : stdev=0.0
test_queue : time=6.36999 : calls=1 : stdev=0.0
test_run   : time=0.00783 : calls=1 : stdev=0.0


Versions #2 and #3 have the same cost, so it's better to get rid of the 
explicit argument and always use the lock (version #3).
Differences between #1 and #3 suggest that introducing the lock obviously have 
a cost though.
It's not too high IMO, but I couldn't say whether it's acceptable or not.
Maybe it makes sense to provide it as a separate class (SynchronizedScheduler).

--

___
Python tracker 
<http://bugs.python.org/issue8684>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8684] improvements to sched.py

2011-12-12 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Are you suggesting to enable thread-synchronization by default and get rid of 
explicit "synchronized" argument?

--

___
Python tracker 
<http://bugs.python.org/issue8684>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8684] improvements to sched.py

2011-12-10 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Updated patch adding a synchronized argument to scheduler class and updating 
doc is in attachment.

--
Added file: http://bugs.python.org/file23903/sched-thread-safe.patch

___
Python tracker 
<http://bugs.python.org/issue8684>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13563] Make use of with statement in ftplib

2011-12-10 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

That's why I nosyed you. Thanks. ;)

--
assignee:  -> giampaolo.rodola
components: +Library (Lib)
keywords: +easy -patch
resolution:  -> fixed
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue13563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13559] Use sendfile where possible in httplib

2011-12-08 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Ops! I meant issue13564.

--

___
Python tracker 
<http://bugs.python.org/issue13559>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13559] Use sendfile where possible in httplib

2011-12-08 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

ftplib's sendfile support is not tracked as issue13559.
Considerations I made there should apply here as well.

--

___
Python tracker 
<http://bugs.python.org/issue13559>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13564] ftplib and sendfile()

2011-12-08 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :

In attachment.
This is actually just an excuse to store the patch somewhere and possibly 
collect opinions as I don't really think this should go in because:

- it's UNIX only
- as such, deciding whether using sendfile() should probably be done silently 
(no explicit argument)
- on the other hand, I don't think it's safe to decide this automatically 
because:
- the input fd should be a regular file and it's not clear how to determine 
this beforehand 
- in case of disconnection OSError is raised instead of socket.error (minor 
backward compatibility issue)

--
files: ftplib-sendfile.patch
keywords: patch
messages: 149076
nosy: giampaolo.rodola
priority: normal
severity: normal
stage: patch review
status: open
title: ftplib and sendfile()
type: feature request
versions: Python 3.3
Added file: http://bugs.python.org/file23890/ftplib-sendfile.patch

___
Python tracker 
<http://bugs.python.org/issue13564>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13563] Make use of with statement in ftplib

2011-12-08 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :

Patch in attachment.

--
files: ftplib.patch
keywords: patch
messages: 149074
nosy: giampaolo.rodola, pitrou
priority: normal
severity: normal
status: open
title: Make use of with statement in ftplib
versions: Python 3.3
Added file: http://bugs.python.org/file23889/ftplib.patch

___
Python tracker 
<http://bugs.python.org/issue13563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13559] Use sendfile where possible in httplib

2011-12-08 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

This is not possible for two reasons:

- on most POSIX systems, sendfile() works with mmap-like ("regular") files 
only, while HTTPConnection.send() accepts any file-like object as long as it 
provides a read() method

- after read()ing a chunk of data from the file and before send()ing it over 
the socket, the data can be subject to an intermediate conversion 
(datablock.encode("iso-8859-1")):
http://hg.python.org/cpython/file/87c6be1e393a/Lib/http/client.py#l839
...whereas sendfile() can only be used to send a binary file "as-is"

I think we can use sendfile() in ftplib.py though .
I'll open a ticket for that.

--

___
Python tracker 
<http://bugs.python.org/issue13559>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8684] improvements to sched.py

2011-11-26 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Looking back at this patch, I think we can extract the thread-synchronization 
parts and the peek() method, as they're both valuable additions, especially the 
first one.

The very sched doc says:

> In multi-threaded environments, the scheduler class has limitations 
> with respect to thread-safety, inability to insert a new task before 
> the one currently pending in a running scheduler, and holding up the 
> main thread until the event queue is empty. Instead, the preferred 
> approach is to use the threading.Timer class instead.

--

___
Python tracker 
<http://bugs.python.org/issue8684>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13451] sched.py: speedup cancel() method

2011-11-26 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


Added file: http://bugs.python.org/file23786/bench.py

___
Python tracker 
<http://bugs.python.org/issue13451>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13451] sched.py: speedup cancel() method

2011-11-26 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

New patch in attachment takes care of modifying empty() and queue property 
according with the new implementation.
With this, the API behaves the same as before (this was my main concern).
Also, it's smarter when it comes to cleaning up too many pending cancelled 
items:

if self._cancellations > 50 \
  and self._cancellations > (len(self._queue) >> 1):
 ...

Also, I made a little benchmark script (in attachment) to make sure that the 
speed of the rest of the API hasn't been significantly affected by this change:


BEFORE THE PATCH

test_cancel: time=0.66648 : calls=1 : stdev=0.0
test_empty : time=0.00026 : calls=1 : stdev=0.0
test_enter : time=0.00309 : calls=1 : stdev=0.0
test_queue : time=6.20777 : calls=1 : stdev=0.0
test_run   : time=0.00746 : calls=1 : stdev=0.0


AFTER THE PATCH

test_cancel: time=0.00054 : calls=1 : stdev=0.0
test_empty : time=0.00031 : calls=1 : stdev=0.0
test_enter : time=0.00375 : calls=1 : stdev=0.0
test_queue : time=6.30314 : calls=1 : stdev=0.0
test_run   : time=0.00716 : calls=1 : stdev=0.0

--
nosy: +josiah.carlson, josiahcarlson
Added file: http://bugs.python.org/file23785/cancel.patch

___
Python tracker 
<http://bugs.python.org/issue13451>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13245] sched.py kwargs addition and default time functions

2011-11-22 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Checked in as f1a21f2e3bec and dc52db0fa2e5.
Thanks.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue13245>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13451] sched.py: speedup cancel() method

2011-11-22 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

In attachment. 

Before the patch:
9.433167934417725

After the patch:
0.0016150474548339844

scheduler.queue and scheduler.empty should be modified in accordance (which I 
haven't done, it's just to give you an idea).

--
Added file: http://bugs.python.org/file23753/cancel-later-approach.patch

___
Python tracker 
<http://bugs.python.org/issue13451>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13451] sched.py: speedup cancel() method

2011-11-21 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :


# bench.py
import sched, time
events = []
scheduler = sched.scheduler(time.time, time.sleep)
for x in range(4000):
scheduler.enter(1, 1, lambda: None, ())
t = time.time()
for x in scheduler._queue:
scheduler.cancel(x)
print(time.time() - t)


Before the patch:
9.433167934417725

After the patch:
1.3120810985565186


I have another approach in mind, which avoids removing the element from the 
queue immediately, and which should be an order of magnitude faster, but I'll 
provide that as a separate patch since it poses questions about API and 
backward compatibility.

--
files: sched-cancel-speedup.patch
keywords: patch
messages: 148103
nosy: giampaolo.rodola, rhettinger, stutzbach
priority: normal
severity: normal
status: open
title: sched.py: speedup cancel() method
versions: Python 3.3
Added file: http://bugs.python.org/file23750/sched-cancel-speedup.patch

___
Python tracker 
<http://bugs.python.org/issue13451>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13449] sched - provide an "async" argument for run() method

2011-11-21 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
keywords: +patch
Added file: http://bugs.python.org/file23746/sched-async.patch

___
Python tracker 
<http://bugs.python.org/issue13449>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13449] sched - provide an "async" argument for run() method

2011-11-21 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :

If True it would run the scheduled functions due to expire soonest (if any) and 
then return.
This would make sched module usable into asynchronous applications.

--
messages: 148095
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: sched - provide an "async" argument for run() method
versions: Python 3.3

___
Python tracker 
<http://bugs.python.org/issue13449>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13245] sched.py kwargs addition and default time functions

2011-11-21 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Updated patch in attachment.

--
Added file: http://bugs.python.org/file23745/issue13245.patch

___
Python tracker 
<http://bugs.python.org/issue13245>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13245] sched.py kwargs addition and default time functions

2011-11-21 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

I think this should go in.
I'm going to provide a slighly modified version of the attached patch which 
includes document changes and get rid of some unit tests which are not really 
necessary in my opinion.

--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13245>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3974] collections.namedtuple uses exec to create new classes

2011-11-11 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue3974>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1677872] Efficient reverse line iterator

2011-11-08 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue1677872>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, adding shutil.which

2011-11-08 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue444582>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6397] Implementing Solaris "/dev/poll" in the "select" module

2011-11-08 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue6397>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13344] closed sockets don't raise EBADF anymore

2011-11-04 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 
<http://bugs.python.org/issue13344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



<    4   5   6   7   8   9   10   11   12   13   >