Re: [Python-Dev] httplib and bad response chunking

2006-07-31 Thread Greg Ward
[me, on 25 July]
> I have
> discovered other hypothetical cases of bad chunking that cause httplib
> to go into an infinite loop or block forever on socket.readline().
> Should we worry about those cases as well, despite not having seen them
> happen in the wild?  More annoying, I can reproduce the "block forever"
> case using a real socket, but not using the StringIO-based FakeSocket
> class in test_httplib.

[John J Lee]
> They have been seen in the wild :-)
> 
> http://python.org/sf/1411097

Thanks -- that was really all the encouragement I needed to keep banging
away at this bug.

Did you look at the crude attempt at testing for this bug that I hacked
into test_httplib.py?  I posted it to bug #1486335 here:

  
http://sourceforge.net/tracker/download.php?group_id=5470&atid=105470&file_id=186245&aid=1486335

The idea is simple: put various chunked responses into strings and then
feed those strings to HTTPConnection.  The trouble is that StringIO does
not behave the same as a real socket: where HTTPResponse fails one way
reading from a real socket (eg. infinite loop), it fails differently (or
not at all) reading from a StringIO.  Makes testing with the FakeSocket
class in test_httplib.py problematic.

Maybe the right way to test httplib is to spawn a server process
(thread?) to listen on some random port, feed various HTTP responses at
HTTPConnection/HTTPResponse, and see what happens.  I'm not sure how to
do that portably, though.  Well, I'll see if I can whip up a Unix-y
solution and see if anyone knows how to make it portable.

Greg
-- 
Greg Ward <[EMAIL PROTECTED]> http://www.gerg.ca/
Be careful: sometimes, you're only standing on the shoulders of idiots.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Rounding float to int directly (Re: struct module and coercing floats to integers)

2006-07-31 Thread Raymond Hettinger
Greg Ewing wrote:

>As an aside, does anyone else think that it would be
>useful to have a builtin which rounds and converts to
>an int in one go? Whenever I use round(), I almost
>always want the result as an int, and making me do
>it in two steps seems unnecessarily bothersome.
>  
>
I think this would harm more than it would help.  It more confusing to 
have several rounding-thingies to choose from than it is have an 
explicit two-step.


BTW,  I thought the traditional idiom (for positive numbers) was:  int(x+.5)


>Since automatic float->int coercion is being increasingly
>disallowed, use cases for this are becoming more and more
>common.
>
>--
>Greg
>___
>Python-Dev mailing list
>[email protected]
>http://mail.python.org/mailman/listinfo/python-dev
>Unsubscribe: 
>http://mail.python.org/mailman/options/python-dev/rhettinger%40ewtllc.com
>  
>

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Patch submitted, now what?

2006-07-31 Thread Chad Whitacre
Dear All,

Last week I submitted a patch (my first), and now I'm wondering what my 
expectations should be. Do I sit around and wait? How long? Do I notify 
this list? Do I notify a specific person, say, an author or reviewer of 
the original code I modified? Do I use SF's assignment mechanism? Who do 
I assign it to?

These are the questions I have, unanswered (afaict) by the patch 
documentation I've found:

   http://www.python.org/dev/patches/
   http://www.python.org/dev/patches/style/
   http://www.python.org/patches/
   http://www.python.org/patches/style.html
   http://www.python.org/dev/tools/#patch-tracking


Any insight?




chad


P.S. For the interested, here is my patch:

   "Expose case-insensitivity of string.Template"
   http://www.python.org/sf/1528167
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Patch submitted, now what?

2006-07-31 Thread Brett Cannon
On 7/31/06, Chad Whitacre <[EMAIL PROTECTED]> wrote:
Dear All,Last week I submitted a patch (my first),Thanks! 
 and now I'm wondering what myexpectations should be. Do I sit around and wait? How long? Do I notifythis list? Do I notify a specific person, say, an author or reviewer ofthe original code I modified? Do I use SF's assignment mechanism? Who do
I assign it to?Let it sit for now.  We get email notifications when new patches come in.  Since we are all volunteers it can take a little while before we get to it.And don't assign it to anyone.  Let us handle that.
These are the questions I have, unanswered (afaict) by the patchdocumentation I've found:
   http://www.python.org/dev/patches/   http://www.python.org/dev/patches/style/   
http://www.python.org/patches/   http://www.python.org/patches/style.html   http://www.python.org/dev/tools/#patch-tracking
Those docs needs to be overhauled.  I am planning to consolidate into a single patch guidelines doc in a month or so. 
Any insight?chadP.S. For the interested, here is my patch:   "Expose case-insensitivity of string.Template"   http://www.python.org/sf/1528167
___Python-Dev mailing [email protected]://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/brett%40python.org
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Patch submitted, now what?

2006-07-31 Thread Chad Whitacre
Brett,

Thanks for the helpful reply.


> Let it sit for now.  We get email notifications when new patches come in.

Can I ask who "we" are? Is that the seven SF "Project Admins?" Is that 
the 68 SF "Developers?"

And is every patch eventually responded to? Or do some simply fall by 
the wayside?


> Those docs needs to be overhauled.  I am planning to consolidate into a
> single patch guidelines doc in a month or so.

Great! I'd be happy to review it when the time comes, if that'd be helpful.

Thanks again.




chad
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Patch submitted, now what?

2006-07-31 Thread Brett Cannon
On 7/31/06, Chad Whitacre <[EMAIL PROTECTED]> wrote:
Brett,Thanks for the helpful reply.> Let it sit for now.  We get email notifications when new patches come in.Can I ask who "we" are? Is that the seven SF "Project Admins?" Is that
the 68 SF "Developers?""We" is most of the developers on python-dev.  There is a Python patches mailing list that most developers subscribe to.
And is every patch eventually responded to? Or do some simply fall bythe wayside?The latter unfortunatley.  Since this all relies on people's volunteer efforts the patch usually has to matter to someone to lead to them putting the time and effort into getting it checked in. 
> Those docs needs to be overhauled.  I am planning to consolidate into a
> single patch guidelines doc in a month or so.Great! I'd be happy to review it when the time comes, if that'd be helpful.Yep, it would be.-Brett 
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Patch submitted, now what?

2006-07-31 Thread skip

Chad> And is every patch eventually responded to? Or do some simply fall
Chad> by the wayside?

Brett> The latter unfortunatley.  Since this all relies on people's
Brett> volunteer efforts the patch usually has to matter to someone to
Brett> lead to them putting the time and effort into getting it checked
Brett> in.

It's worth noting that a number of people will look at a patch after the
submitter has reviewed five other patches or bug reports (does it look okay
to you?  does Python build with it applied?  do all unit tests pass? if it
needs documentation does it have it? etc).  Do that, attach comments to each
of the five, then send a note here listing the five you reviewed and the
patch id of your patch and one of those patch angels will take a look at
your patch (if they haven't already).

Skip
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Patch submitted, now what?

2006-07-31 Thread Chad Whitacre
Brett,

> "We" is most of the developers on python-dev.  There is a Python patches
> mailing list that most developers subscribe to.

Helpful, thanks.


> The latter unfortunatley.  Since this all relies on people's volunteer
> efforts the patch usually has to matter to someone to lead to them putting
> the time and effort into getting it checked in.

Hrm, ok, also good to know. So it sounds like I wait another week or so 
and then maybe approach some folks individually.



chad
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Patch submitted, now what?

2006-07-31 Thread Chad Whitacre
Skip,

> It's worth noting that a number of people will look at a patch after the
> submitter has reviewed five other patches or bug reports

Also helpful, thanks!



chad
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Patch submitted, now what?

2006-07-31 Thread Martin v. Löwis
Chad Whitacre schrieb:

[I notice that my message comes across pretty negative. In a single
 sentence: We are all volunteers with limited time, and we contribute
 to Python because its fun and because it helps us solve our own
 problems.]
> Last week I submitted a patch (my first), and now I'm wondering what my 
> expectations should be.

As a starting point, it would be better if you had provided the patch
number (1528167) in this message. That makes it easier to answer the
questions. [I didn't read until the end of the message yet]

> Do I sit around and wait? How long? 

It's a new feature, so it can't possibly get into Python 2.5. That means
that no action is likely taken before October. It might take years until
the patch gets considered. As others have mentioned, there are ways to
expedite processing.

> Do I notify this list?

If you want discussion of the patch, you can do that. Depending on
how many people care about that aspect of Python, you may or may
not get a response.

I personally don't see myself using $-interpolation in the next
few years, so I doubt I will react in any way (the Python library
would just be the same for me if that feature didn't exist, and your
patch isn't a bug fix).

Others are more interested in the feature (or else it wouldn't
have gotten into the standard library), so they might respond.

> Do I notify a specific person, say, an author or reviewer of 
> the original code I modified? 

You might do that, although some may consider this at the
edge of spamming.

> Do I use SF's assignment mechanism? 

Please don't. If your assignment is "incorrect", this is a guarantee
that the patch will sit there forever: the person assigned won't react
because he doesn't feel responsible if he isn't, and nobody else
will feel responsible because the patch is assigned.

As Skip explains, I have a 5-for-1-rule for people who really want
to push their patches: If you review 5 patches, I will review yours
(despite me normally ignoring patches to this part of the library).

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Patch submitted, now what?

2006-07-31 Thread Chad Whitacre
Martin,

Thanks for the reply.

> I notice that my message comes across pretty negative. 

No worries. I'm a volunteer too. :)


> It's a new feature, so it can't possibly get into Python 2.5. That means
> that no action is likely taken before October. It might take years until
> the patch gets considered.

Helpful, thanks.


> As Skip explains, I have a 5-for-1-rule for people who really want
> to push their patches: If you review 5 patches, I will review yours

Yeah, this hit the bulls-eye for me. The 5-for-1 rule is a great way to 
specify how newcomers can influence patch workflow w/o becoming 
spammers. [Brett: +1 on mentioning this in the updated Patch Guidelines]

Watch for another post once I've found the time to volunteer to review 5 
other patches. :)


Thanks again, all! Consider my original questions answered.




chad
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Rounding float to int directly (Re: struct module and coercing floats to integers)

2006-07-31 Thread Greg Ewing
Raymond Hettinger wrote:

> I think this would harm more than it would help.  It more confusing to 
> have several rounding-thingies to choose from than it is have an 
> explicit two-step.

But is it more confusing enough to be worth forcing
everyone to pay two function calls instead of one
in the most common case?

If I'm right that rounding-to-int is much more
commonly needed than rounding-to-float, the least
confusing thing would be for the builtin round()
to return an int, and have something somewhere
else, such as math.fround(), for round-to-float.

> BTW,  I thought the traditional idiom (for positive numbers) was:  
> int(x+.5)

It's the "for positive numbers" that's the problem
there. Most of my uses for round() involve graphics
coordinates, which I can't be sure won't be negative.
It's not immediately obvious what this will do with
negative numbers. It's not even immediately obvious
that it's doing round-to-nearest-integer unless
you're familiar with the idiom. A single well-named
function would be much more explicit.

--
Greg
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com