[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

The more I think about this, the more concerned I am about changing the number 
of elements in the tuple. That's the change that broke platform.py. Maybe we 
should add a parameter named something like level, defaulting to 0.

0 = existing behavior, but with named tuple
1 = return named 9-tuple OSVERSIONINFOEX values
other values: reserved for future use

Or maybe we should make it a bool instead, and not worry about future expansion.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7782] new test for test_iter.py

2010-01-26 Thread showell

New submission from showell showel...@yahoo.com:

I would like to submit the following test to be part of the test_iter.py test 
suite:

def test_extends(self):
# This test would break on an incomplete patch to listobject.c
def gen():
for i in range(500):
yield i
lst = [0] * 500
for i in range(240):
lst.pop(0)
lst.extend(gen())

The history behind it is that I made a patch to listobject.c that obviously 
broke listextend(), but the tests did not catch it.  This was my failing test 
to improve my patch.  Regardless of what happens to the patch, I think it's a 
good idea to hammer on listextend() when it accepts an iterator, as it's a 
fairly tricky problem to extend a list when you do not know in advance how long 
it will be until the iterator gets exhausted.

--
components: Tests
messages: 98320
nosy: Steve Howell
severity: normal
status: open
title: new test for test_iter.py
type: behavior
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7782
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5689] please support lzma compression as an extension and in the tarfile module

2010-01-26 Thread Glenn Linderman

Changes by Glenn Linderman v+pyt...@g.nevcal.com:


--
nosy: +v+python

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5689
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7783] test_normalization fails when NormalizationTest.txt is outdated

2010-01-26 Thread Florent Xicluna

New submission from Florent Xicluna la...@yahoo.fr:

The test test_normalization download a file from the unicode.org website 
and keep it in the local cache Lib/test/data/ directory for next runs.
On test setup, it verifies if the 1st line contains the right version 
unicodedata.unidata_version.
It should unlink the file if it is outdated.
But it does not work as expected: it looks for the file in the wrong directory.

~ $ echo # NormalizationTest-3.0.0.txt ~ outdated version  
Lib/test/data/NormalizationTest.txt

~ $ ./python -m test.regrtest -uall test_normalization
test_normalization
test test_normalization failed -- Traceback (most recent call last):
  File ./Lib/test/test_normalization.py, line 96, in test_main
self.assertTrue(X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c)
AssertionError: 160

1 test failed:
test_normalization

~ $ cat Lib/test/data/NormalizationTest.txt
# NormalizationTest-3.0.0.txt ~ outdated version

--
components: Tests, Unicode
messages: 98321
nosy: flox
severity: normal
status: open
title: test_normalization fails when NormalizationTest.txt is outdated
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7783
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7783] test_normalization fails when NormalizationTest.txt is outdated

2010-01-26 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Here is a patch.

The function test_support.open_urlresource is enhanced with an optional 
argument check which receives a function. This check function accepts an 
open file as input and return False if the file is outdated.

--
keywords: +patch
versions: +Python 3.2
Added file: http://bugs.python.org/file16007/issue7783_normalization.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7783
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Eric Smith wrote:
 
 Eric Smith e...@trueblade.com added the comment:
 
 The more I think about this, the more concerned I am about changing the 
 number of elements in the tuple. That's the change that broke platform.py. 
 Maybe we should add a parameter named something like level, defaulting to 0.
 
 0 = existing behavior, but with named tuple
 1 = return named 9-tuple OSVERSIONINFOEX values
 other values: reserved for future use
 
 Or maybe we should make it a bool instead, and not worry about future 
 expansion.

The usual approach to such problems is keeping the number of tuple
items and their order the same and only add new items as additional
attributes to the struct.

See the CodecInfo tuple in codecs.py for an example on how this is
done. The tuple is still a 4-tuple, but it provides access to more
items via named attributes.

--
nosy: +lemburg

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7784] patch for making list/insert at the top of the list avoid memmoves

2010-01-26 Thread showell

New submission from showell showel...@yahoo.com:

I am attaching a patch to improve the performance of list operations that 
insert or delete elements at the front of the list.  The patch has had some 
discussion on python-dev in the thread entitled patch to make list.pop(0) work 
in O(1) time.

So far the verdict is not to touch list internals to achieve this performance 
gain, but I am looking to improve the patch regardless and possibly include it 
in a PEP that documents the decision not to incorporate the patch, with the 
hope that it either prevents future duplication of effort or eventually gets 
accepted.

At a bare minimum, the patch needs extensive code review, as it touches a lot 
of internals, and it needs stylistic cleanup.  But it does pass all the tests, 
and it has been benchmarked to show 100X speed improvement on a small test case.

--
components: Interpreter Core
files: DIFF
messages: 98324
nosy: Steve Howell
severity: normal
status: open
title: patch for making list/insert at the top of the list avoid memmoves
type: performance
versions: Python 3.2
Added file: http://bugs.python.org/file16008/DIFF

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7784
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1205239] Let shift operators take any integer value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Interesting.  I agree that that looks like a case where it would be desirable 
for a  -n to do a  n.

By the way, I don't think your formula is quite correct:  your crc is going to 
grow unboundedly as extra data bytes come in.  I suspect that you want to mask 
the result with (1  crc_width) - 1 after each update.
(And what's the ' 0xFF' for?  Isn't it redundant?)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1205239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1205239] Let shift operators take any integer value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

One other thought: you could always compute the expression

  crc  (crc_width - 8)

as

  crc  8  crc_width

Since you're computing crc  8 anyway, this doesn't increase the operations 
count, so probably wouldn't significant impact performance.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1205239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7615] unicode_escape codec does not escape quotes

2010-01-26 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Amaury Forgeot d'Arc wrote:
 I feel uneasy to change the default unicode-escape encoding.
 I think that we mix two features here; to transfer a unicode string between 
 two points, programs must agree on where the data ends, and how characters 
 are represented as bytes.
 All codecs including unicode-escape only dealt with byte conversion; 
 (unicode-escape converts everything to printable 7bit ascii);
 these patches want to add a feature related to the where does the string 
 end issue, and is only aimed at python code containers. Other transports 
 and protocols may choose different delimiters.
 
 My point is that unicode-escape used to not change printable 7-bit ascii 
 characters, and the patches will change this.
 
 And actually this will break existing code. It did not take me long to find 
 two examples of programs which embed unicode_escape-encoded text between 
 quotes, and take care themselves of escaping quotes. First example generates 
 javascript code, the second generates SQL statements:
 http://github.com/chriseppstein/pywebmvc/blob/master/src/code/pywebmvc/tools/searchtool.py#L450
 http://gitweb.sabayon.org/?p=entropy.git;a=blob;f=libraries/entropy/db/__init__.py;h=2d818455efa347f35b2e96d787fefd338055d066;hb=HEAD#l6463

Ouch... these codecs should not have been used outside
Python. I wonder why these applications don't use repr(text)
to format the JavaScript/SQL strings.

I guess this is the result of documenting them in
http://docs.python.org/library/codecs.html#standard-encodings

Too bad that the docs actually say Produce a string that is
suitable as Unicode literal in Python source code. The codecs
main intent was to *decode* Unicode literals in Python source
code to Unicode objects...

The naming in the examples you mention also suggest that the
programmers used the table from the docs - they use
unicode_escape as codec name, not the standard
unicode-escape name which we use throughout the Python
code.

The fact that the demonstrated actual use already does apply the
extra quote escaping suggests that we cannot easily add this
to the existing codecs. It would break those applications, since
they'd be applying double-escaping.

 This does not prevent the creation of a new codec, let's call it 
 'python-unicode-escape' [ or 'repr' :-) ]

I think that's a good idea to move forward.

Python 3.x comes with a new Unicode repr() format which we could
turn into a new codec: it automatically adds the quotes, processes
the in-string quotes and backslashes and also escapes \t, \n and \r
as well as all non-printable code points.

As for naming the new codec, I'd suggest unicode-repr since
that's what it implements.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7615
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7784] patch for making list/insert at the top of the list avoid memmoves

2010-01-26 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Steve, thank you for your patch.

IMHO, it's better to provide a patch against trunk (Py2) when the optimization 
is not specific to 3.x.

I merged it manually on my working copy, and all tests pass without leaking. 
Patch for Py2 attached.

However, I am not an expert. I just cleaned the tab/space mix to conform with 
what is used in the listobject.c file.

--
keywords: +patch
nosy: +flox
stage:  - patch review
versions: +Python 2.7
Added file: http://bugs.python.org/file16009/issue7784_listobject_perf.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7784
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7784] patch for making list/insert at the top of the list avoid memmoves

2010-01-26 Thread showell

showell showel...@yahoo.com added the comment:

--- On Tue, 1/26/10, Florent Xicluna rep...@bugs.python.org wrote:

 From: Florent Xicluna rep...@bugs.python.org
 Subject: [issue7784] patch for making list/insert at the top of the list 
 avoid memmoves
 To: showel...@yahoo.com
 Date: Tuesday, January 26, 2010, 3:53 AM
 
 Florent Xicluna la...@yahoo.fr
 added the comment:
 
 Steve, thank you for your patch.
 
 IMHO, it's better to provide a patch against trunk (Py2)
 when the optimization is not specific to 3.x.
 
 I merged it manually on my working copy, and all tests pass
 without leaking. Patch for Py2 attached.
 
 However, I am not an expert. I just cleaned the tab/space
 mix to conform with what is used in the listobject.c file.
 

Thank you!  My only rationale for applying the patch to 3.x was that it would 
minimize backward compatibility concerns, but I do not have a strong opinion 
either way.

You probably noticed a few stylistic mistakes, such as these lines:

a-orphans += (-1 * d);
a-ob_item += (-1 * d);

All feedback on ways to improve this code would be greatly welcome.

Thanks again.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7784
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Great idea, Marc-Andre. I agree that's the better approach.

It looks like PyStructSequence supports this, by setting n_in_sequence to a 
value smaller then the number of PyStructSequence_Fields. A quick look doesn't 
show any uses of this in the C code (except maybe os.stat), but I'll 
investigate and make sure that's a supported use case.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7372] Regression in pstats

2010-01-26 Thread Jim Fulton

Jim Fulton j...@zope.com added the comment:

On Mon, Jan 25, 2010 at 7:35 PM, Ezio Melotti rep...@bugs.python.org wrote:

 Ezio Melotti ezio.melo...@gmail.com added the comment:

 See also #7372.

 AFAIU add_callers can receive either a tuple or an int (and this is what is 
 not working now). When I looked at #7372 I wasn't able to find out why it 
 might receive two different objects and not always the same (i.e. always a 
 tuple, possibly with only one int). From the first message it seems that 
 cProfile returns the tuple of 4 ints and profile returns a single int.
 Can profile be fixed to return a tuple (of 4 or 1 ints) too?

Ah interesting.  I ran into this recently when I noticed that some
analysis tools I'd written a while back no longer worked and had to be
updated because data that were ints were now tuples.

Aside from these particular issues, it would be really great if the
profiler stats data structure was specified. :)

Jim

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Eric Smith wrote:
 
 Eric Smith e...@trueblade.com added the comment:
 
 Great idea, Marc-Andre. I agree that's the better approach.
 
 It looks like PyStructSequence supports this, by setting n_in_sequence to a 
 value smaller then the number of PyStructSequence_Fields. A quick look 
 doesn't show any uses of this in the C code (except maybe os.stat), but I'll 
 investigate and make sure that's a supported use case.

If not, I'd suggest to move the code to Python, e.g. add a
class to the new sysinfo.py module, and then instantiate it via a C
call.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7785] FileIO.write() accepts Unicode strings

2010-01-26 Thread David Beazley

New submission from David Beazley d...@dabeaz.com:

Is io.FileIO.write() supposed to accept and implicitly encode Unicode strings 
as illustrated by this simple example?

 f = open(/dev/null,wb,buffering=0)
 f.write(Hello World\n)
12
 

Moreover, is the behavior of BufferedWriter objects supposed to be different as 
illustrated by this example:

 f = open(/dev/null,wb)
 f.write(Hello World\n)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: write() argument 1 must be bytes or buffer, not str


--
components: IO
messages: 98333
nosy: dabeaz
severity: normal
status: open
title: FileIO.write() accepts Unicode strings
type: behavior
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7785
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7564] test_ioctl may fail when run in background

2010-01-26 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Patch to skip the test with the appropriate warning in verbose mode.

--
keywords: +patch
stage:  - patch review
Added file: http://bugs.python.org/file16010/issue7564_test_ioctl.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7564
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7242] Forking in a thread raises RuntimeError

2010-01-26 Thread Zsolt Cserna

Zsolt Cserna zsolt.cse...@morganstanley.com added the comment:

Ok, here's the new patch. I've removed the #ifdef-#endif lines. It passed the 
test thread_test.py on linux (and as well on solaris).

--
Added file: http://bugs.python.org/file16011/patch_2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7242
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7785] FileIO.write() accepts Unicode strings

2010-01-26 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7785
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Here's a patch that implement's Marc-Andre's suggestion. The docstring and 
documentation need work. I still need to verify that this isn't a misuse of 
PyStructSequence, but the tests pass on Windows. I need to verify a few other 
platforms to make sure the #ifdef logic is correct.

--
Added file: http://bugs.python.org/file16012/winver_as_structseq_ex2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7564] test_ioctl may fail when run in background

2010-01-26 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file16010/issue7564_test_ioctl.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7564
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7564] test_ioctl may fail when run in background

2010-01-26 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Patch to make the skip message visible in normal mode:

test_ioctl
test_ioctl skipped -- Process group 1844 is associated with /dev/tty


And in the summary you have the information:

1 test skipped:
test_ioctl
1 skip unexpected on linux2:
test_ioctl

--
Added file: http://bugs.python.org/file16013/issue7564_test_ioctl.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7564
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7785] FileIO.write() accepts Unicode strings

2010-01-26 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti
priority:  - normal
stage:  - test needed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7785
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Thanks a lot for taking a look at this, Eric and Marc-Andre. Apologies for the 
few mistakes in there, I jumped the gun and submitted that last patch before 
having run the full test suite again.

Good catch on the missing #ifdef. I will also run this on Mac and Linux today 
and make sure nothing slips by, but it looks to be fine.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7782] new test for test_iter.py

2010-01-26 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

From the comment (This test would break on an incomplete patch to 
listobject.c) is not clear what exactly the test is supposed to check.
Probably the test should include some assert* or more comments if it is 
supposed to work but it might raise an error if there's something wrong.
Finally it would be better if you can provide a patch against trunk and attach 
it to the issue.

--
nosy: +ezio.melotti
priority:  - normal
stage:  - patch review
versions: +Python 2.6, Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7782
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7564] test_ioctl may fail when run in background

2010-01-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Could the skip message be made a little more explanatory?  I have no idea why 
Process group 1844 is associated with /dev/tty would mean that test_ioctl 
would need to be skipped.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7564
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7092] Test suite emits many DeprecationWarnings when -3 is enabled

2010-01-26 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

json is now fixed in r77755.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7092
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified

2010-01-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

First of all, thanks for working on this.  Now for some feedback :)

It is most helpful if you provide patches against trunk (which is 2.7 alpha 
right now).  We then forward port them to py3k.  (This will change after the 
release of 2.7, when py3k will become trunk.)

Isn't the assert you added to nameCheck redundant?  It seems to me it would be 
better just to remove the abspath call on ndir from the existing assert.

I haven't applied and tested the patch, but the other changes to the tests look 
odd to me.  Why are you obtaining the abspath of the current directory?  And 
why do those tests need to be changed at all?

Your additional test case looks like it might be some exploration code you 
forgot to delete before generating the patch, maybe those other changes are as 
well?

--
stage: test needed - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7325
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1559298] test_popen fails on Windows if installed to Program Files

2010-01-26 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1559298
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7786] Is the BlockingIOError exception an aborted idea?

2010-01-26 Thread David Beazley

New submission from David Beazley d...@dabeaz.com:

Documentation (e.g., docstrings) for the io module make mention of a 
BlockingIOError exception that might be raised if operations are performed on a 
file that's in non-blocking mode.  However, I am unable to get this exception 
on any operation (instead None is returned for non-blocking).  Moreover, I 
can't find any reference in the C/Python source for the io module that ever 
raises this exception.

Perhaps someone can clarify the status of this exception?

--
components: IO
messages: 98343
nosy: dabeaz
severity: normal
status: open
title: Is the BlockingIOError exception an aborted idea?
type: behavior
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7786
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7564] test_ioctl may fail when run in background

2010-01-26 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file16013/issue7564_test_ioctl.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7564
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7564] test_ioctl may fail when run in background

2010-01-26 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

A little more explanatory.

--
Added file: http://bugs.python.org/file16014/issue7564_test_ioctl_v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7564
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7787] Add an argument to test_support.open_urlresource to invalidate the cache

2010-01-26 Thread Florent Xicluna

New submission from Florent Xicluna la...@yahoo.fr:

The function open_urlresource never invalidates its cache.
If a file with same name is available in Lib/test/data/, it is returned.

There's a snippet in test_normalization which tries to invalidate the cache, 
but it fails because it looks in the wrong location. (#7783)

--
components: Tests
messages: 98345
nosy: flox
severity: normal
status: open
title: Add an argument to test_support.open_urlresource to invalidate the cache
type: feature request
versions: Python 2.7, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7787
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7633] decimal.py: type conversion in context methods

2010-01-26 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

If none of you is working on it right now, I'll produce a new patch.
Mark, how about this:

 def __add__(self, other, context=None, raiseit=False):
Returns self + other.

-INF + INF (or the reverse) cause InvalidOperation errors.

other = _convert_other(other, raiseit)
if other is NotImplemented:
return other


Then the context functions could look cleaner.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7633
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7633] decimal.py: type conversion in context methods

2010-01-26 Thread Juan José Conti

Juan José Conti jjco...@gmail.com added the comment:

I've been working in the modified version of my last patch to solve the 6 
mentioned points. I'm posting it in less than 24 hs.

If you're not hurry, please wait for me. This is just my second patch and is 
very useful to learn how to contribute to Python.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7633
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7787] Add an argument to test_support.open_urlresource to invalidate the cache

2010-01-26 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


--
priority:  - normal

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7787
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Jan Kaliszewski

New submission from Jan Kaliszewski z...@chopin.edu.pl:

del list_instance([start : stop : very_big_step]) causes segfaults...

The boundary values seem to be:
* start -- near length of the list
* stop -- near (-length) of the list
* very_big_step -- near sys.maxint

Let examples speak...

 from sys import maxint
 del range(10)[::maxint]
Segmentation fault

 from sys import maxint
 del range(10)[13::maxint]
 del range(10)[12::maxint]
 del range(10)[11::maxint]
 del range(10)[10::maxint]
 del range(10)[9::maxint]
Segmentation fault

 from sys import maxint
 del range(10)[:-13:maxint]
 del range(10)[:-12:maxint]
 del range(10)[:-11:maxint]
 del range(10)[:-10:maxint]
 del range(10)[:-9:maxint]
Segmentation fault

 from sys import maxint
 del range(10)[-8:8:maxint-5]
 del range(10)[-8:8:maxint-4]
 del range(10)[-8:8:maxint-3]
 del range(10)[-8:8:maxint-2]
Segmentation fault

System Info:
* Python 2.5.4 (r254:67916, Apr  4 2009, 17:55:16) 
* [GCC 4.3.3] on linux2
* sys.maxint == 2147483647, sys.byteorder == 'little'
* Processor: Pentium 4
* libc version: 2.9 (2.9-4ubuntu6)

--
components: Interpreter Core
messages: 98348
nosy: zuo
severity: normal
status: open
title: segfault when deleting from a list using slice with very big `step' value
type: crash
versions: Python 2.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7633] decimal.py: type conversion in context methods

2010-01-26 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Juan: Sure, take your time. :) I just wanted to know if you were still busy 
with it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7633
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Jan Kaliszewski

Jan Kaliszewski z...@chopin.edu.pl added the comment:

** Erratum **
-- was:
del list_instance([start : stop : very_big_step]) causes segfaults...
-- should be:
del list_instance[start : stop : very_big_step]
causes segfaults...

** Post scriptum **
In each example only the last statement causes segmentation fault (previous are 
OK, and I attached them on purpose -- to show exemplary boundary values when 
things start going wrong).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7633] decimal.py: type conversion in context methods

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Juan, don't worry about the documentation if you don't want to.  I can fix that 
up easily.  (Of course, if you do want to, go ahead!)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7633
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

This is what I get on trunk:
Python 2.7a2+ (trunk:77754:77755, Jan 26 2010, 20:16:49)
[GCC 4.4.1] on linux2
Type help, copyright, credits or license for more information.
 from sys import maxint
 del range(10)[::maxint]
 del range(10)[:-9:maxint]
 del range(10)[-8:8:maxint-2]
 del range(10)[9::maxint]
Segmentation fault

Confirmed on py3k too.

--
nosy: +ezio.melotti
priority:  - normal
stage:  - test needed
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
nosy: +mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


--
nosy: +flox, haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Raising priority:  it shouldn't be possible to crash Python this easily.

Ezio, are you on a 64-bit or 32-bit system?

--
priority: normal - critical

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7633] decimal.py: type conversion in context methods

2010-01-26 Thread Facundo Batista

Facundo Batista facu...@taniquetil.com.ar added the comment:

Juanjo, ping me in private if you want help with the doc toolchain, I can show 
you how to touch the .rst and see the changes after processing.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7633
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

32bit, with sys.maxint/maxsize == 2147483647.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Jan Kaliszewski

Jan Kaliszewski z...@chopin.edu.pl added the comment:

Interesting that in Py2.5...

 del range(10)[::maxint]

...this causes segfault but in Py2.6 is ok, as well as in Py3.0 (with maxsize 
insetad of maxint). (That's why I didn't noticed that it concerns newer version 
than 2.5, and marked only 2.5).

But, as Ezio noted, e.g.:

 del range(10)[5::maxint]

...crashes all of them, e.g:

Python 3.0.1+ (r301:69556, Apr 15 2009, 15:59:22)
[GCC 4.3.3] on linux2
 from sys import maxsize
 del list(range(10))[::maxsize]  # - OK
 del list(range(10))[5::maxsize]
Segmentation fault

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I can confirm the most recent patch (ex2) doesn't break anything on MacOS or 
Linux.

It's clear that structseq.c is designed to be used this way, with more named 
members than unnamed members (and vice-versa, actually). See n_members vs. 
n_in_sequence in Objects/structseq.c.

I'll work on the docstring and documentation then I'll commit it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7786] Is the BlockingIOError exception an aborted idea?

2010-01-26 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7786
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread JordanS

New submission from JordanS jps...@mun.ca:

format() cannot handle datetime.DateTime objects, returns the format_spec 
instead, without applying formatting to it, perhaps default behaviour in case 
of unknown type. Different modifications, ie: using str.format() syntax produce 
same behaviour.

Sample code: 

import datetime

#data
row = {0: 1, 'BeamId': 218, 2: 0.0, 3: 0.0, 4: datetime.datetime(2006, 7, 18, 
0, 12), 5: datetime.datetime(2007, 2, 23, 18, 26, 55, 45), 6: 
32637.774406455803, 1: 218, 'DateAndTime': datetime.datetime(2007, 2, 23, 18, 
26, 55, 45), 'AvgFlexuralStrengthDown': 32637.774406455803, 'WarmUpTime': 
datetime.datetime(2006, 7, 18, 0, 12), 'AvgFlexuralStrengthUp': 
15916.5463146028, 'IceSheetId': 1, 'Y': 0.0, 'X': 0.0, 7: 15916.5463146028}

titles = ['BeamId', 'DateAndTime', 'AvgFlexuralStrengthDown', 'WarmUpTime', 
'AvgFlexuralStrengthUp', 'IceSheetId', 'Y', 'X']

#attempt to print datetime: ignores formatting, doesn't print datetime value, 
prints format_spec instead
for key in titles:
asLine = {0:*30}.format(row[key])
print(asLine),
print '\n'

#prints a repr of datetime
for key in titles:
asLine = {0!r:*30}.format(row[key])
print(asLine),
print '\n'

#prints datetime as string
for key in titles:
asLine = {0!s:*30}.format(row[key])
print(asLine),
print '\n'

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 98358
nosy: JordanS
severity: normal
status: open
title: Issue using datetime with format()
type: behavior
versions: Python 2.6, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Jan Kaliszewski

Jan Kaliszewski z...@chopin.edu.pl added the comment:

PS. Is such a data-dependant segfault considered as security problem? (if it 
is, maybe Python2.5 shuld be kept in Versions list)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread Brian Curtin

Changes by Brian Curtin cur...@acm.org:


--
components: +Library (Lib) -2to3 (2.x to 3.0 conversion tool)
priority:  - normal
stage:  - test needed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

I don't immediately see why it would be considered a security issue.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

For the record:

 del bytearray('%%%')[1::1333]
Segmentation fault

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread JordanS

JordanS jps...@mun.ca added the comment:

sorry, first time posting anything like this: 
versions:

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on 
win32

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

datetime.datetime passes its format string to strftime:

 import datetime
 x = datetime.datetime(2001, 1, 2, 3, 4)
 x.strftime('%Y-%m-%d')
'2001-01-02'
 '{0:%Y-%m-%d}'.format(x)
'2001-01-02'

I'll check to make sure this is documented.

--
assignee:  - eric.smith
components: +Documentation -Library (Lib)
nosy: +eric.smith
stage: test needed - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

There's a suspicious looking test in list_ass_subscript in Objects/listobject.c:

if (cur + step = Py_SIZE(self)) {
lim = Py_SIZE(self) - cur - 1;
}

I think what's happening here is that cur + step is overflowing, so that the 
test fails.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

If it is, it isn't any place obvious.  I thought I remembered something about 
using strftime strings in format, but when I looked in the docs for datetime 
and the section on the format mini language I couldn't find it, so I ended up 
doing '{} ...'.format(x.strftime(...) in my code...

--
nosy: +r.david.murray
versions: +Python 2.7, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Marcin Bachry

Marcin Bachry hegel...@gmail.com added the comment:

I think the expression cur + step in line 2660 of listobject.c (py2.7 trunk) 
overflows to negative value and the if branch isn't entered.

  if (cur + step = Py_SIZE(self)) {
lim = Py_SIZE(self) - cur - 1;
   }

If I change the type of cur variable to unsigned int, the bug disappears. I 
don't know if it's ok to have unsigned cur here though - but I feel it is.

--
keywords: +patch
nosy: +marcin.bachry
Added file: http://bugs.python.org/file16015/maybe-a-fix.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I don't think this is documented (that I can find, at least), so I'll assign it 
to Georg.

I think the correct thing to do is something like this, in the datetime, date, 
and time object descriptions:

date.__format__(fmt)
For a date d, format(d, fmt) is equivalent to d.strftime(fmt).

Ditto for date.__format__. But maybe there's a better, more obvious place to 
document this.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Thanks.  Yes, that fix seems to work.  I also tried rewriting the suspect test 
as

if (step = Py_SIZE(self) - cur)

but this produced a different failure:  it looks like there's more than one 
point with potential overflow for cur.  Not to mention that the 'cur += step' 
in the for loop can produce undefined behaviour.

So making cur unsigned looks like the right solution here.

It would be good to review the rest of this function for similar problems while 
we're fixing this.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

The documentation for this belongs in the mini-language specification, since 
that just address built-in types. Each type can define its own format 
specification language.

So I think adding documentation of __format__ to each non-builtin type that 
implements __format__ is probably the best way to go.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Eric Smith wrote:
 The documentation for this belongs in the mini-language specification, ...

Oops. does NOT belong in the mini-language specification.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

And judging by flox's result for bytearray, we should check all the other 
sequence types, too.

--
stage: test needed - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Marcin Bachry

Marcin Bachry hegel...@gmail.com added the comment:

Using grep I found the same code in Modules/arraymodule.c:

  from array import array
  del array('i', range(10))[9::1333]

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Nice!  Marcin, are you interested in contributing a patch that fixes the three 
known cases (bytearray, list, array), and also adds suitable tests?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Marcin Bachry

Marcin Bachry hegel...@gmail.com added the comment:

Yes, I can give a shot.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Great---thank you!  I'll review the patch when it's ready.

--
assignee:  - mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Raising priority again.  I'm not sure when 3.1.2 is going out, but I'd like to 
make sure that this issue at least gets considered before it does.

--
priority: critical - release blocker

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7787] Add an argument to test_support.open_urlresource to invalidate the cache

2010-01-26 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

The check argument is any function which receives an open file and return a 
boolean.

For example:
 - verify the version number on the first line (test_normalization)
 - calculate the MD5

--
keywords: +patch
nosy: +r.david.murray
stage:  - patch review
Added file: http://bugs.python.org/file16016/issue7787_urlresource.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7787
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7783] test_normalization fails when NormalizationTest.txt is outdated

2010-01-26 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file16007/issue7783_normalization.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7783
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7783] test_normalization fails when NormalizationTest.txt is outdated

2010-01-26 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Now the fix depends on #7787

--
dependencies: +Add an argument to test_support.open_urlresource to invalidate 
the cache
stage:  - patch review
Added file: http://bugs.python.org/file16017/issue7787_urlresource.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7783
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7783] test_normalization fails when NormalizationTest.txt is outdated

2010-01-26 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Removed file: http://bugs.python.org/file16017/issue7787_urlresource.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7783
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7783] test_normalization fails when NormalizationTest.txt is outdated

2010-01-26 Thread Florent Xicluna

Changes by Florent Xicluna la...@yahoo.fr:


Added file: http://bugs.python.org/file16018/issue7783_normalization_v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7783
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7790] struct_time documentation entry should point to the table defining the tuple

2010-01-26 Thread R. David Murray

New submission from R. David Murray rdmur...@bitdance.com:

In the beginning of 16.3 (time module documentation) the fields of a time tuple 
are defined, and it mentions that struct_time returns a named tuple version.  
The entry for struct_time, which is what you get sent to by the entries for the 
functions that return it if you click on struct_time in their descriptions, 
does not mention the table of values.  It would be helpful (and clearer) if the 
struct_time entry had a link to the table describing the tuple.

--
assignee: georg.brandl
components: Documentation
messages: 98379
nosy: georg.brandl, r.david.murray
priority: low
severity: normal
status: open
title: struct_time documentation entry should point to the table defining the 
tuple
type: feature request
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7790
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Marcin Bachry

Marcin Bachry hegel...@gmail.com added the comment:

I attach the patch. I changed signedness in all three sequence types and made 
sure tests crash when run on unpatched Python.

--
Added file: http://bugs.python.org/file16019/fix.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7788
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4770] binascii module, inconsistent behavior: some functions accept unicode string input

2010-01-26 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Please also add a NEWS entry which mentions the changes to those APIs and the 
change in the email package.

Thanks.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4770
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7784] patch for making list/insert at the top of the list avoid memmoves

2010-01-26 Thread Daniel Stutzbach

Changes by Daniel Stutzbach dan...@stutzbachenterprises.com:


--
nosy: +stutzbach

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7784
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6963] Add worker process lifetime to multiprocessing.Pool - patch included

2010-01-26 Thread Charles Cazabon

Charles Cazabon charlesc-pyt...@pyropus.ca added the comment:

Thanks, Jesse -- it looks good.  If there are bugs remaining in the patch, 
they're mine and not yours.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue7784] patch for making list/insert at the top of the list avoid memmoves

2010-01-26 Thread showell

showell showel...@yahoo.com added the comment:

The next stage for the patch is that I need to switch from using orphans count 
to using ob_allocated pointer.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7784
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7791] Python 2.6 standard library sees also something not in the standard library

2010-01-26 Thread dholth

New submission from dholth dho...@fastmail.fm:

I thought it was really odd that the standard library documentation references 
ipaddr, a module from pypi, not something else in the standard library.

The documentation should explain that the referenced package is not a standard 
part of Python.

http://docs.python.org/library/socket.html#socket.inet_pton

See also

ipaddr.BaseIP.packed()
Platform-independent conversion to a packed, binary format.

--
assignee: georg.brandl
components: Documentation
messages: 98384
nosy: dholth, georg.brandl
severity: normal
status: open
title: Python 2.6 standard library sees also something not in the standard 
library
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7791
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7791] Python 2.6 standard library sees also something not in the standard library

2010-01-26 Thread dholth

dholth dho...@fastmail.fm added the comment:

Also ipaddr.BaseIP.packed is a property, not a method, so no ()

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7791
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7791] Python 2.6 standard library sees also something not in the standard library

2010-01-26 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

unittest also does this, but it does so at the top and references projects as a 
whole, rather than individual functions/classes in the project.

Seems like this should be taken out. It doesn't exist in any version after 2.6.

--
nosy: +brian.curtin
priority:  - low
stage:  - needs patch
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7791
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7792] Errors registering non-classes with ABCs

2010-01-26 Thread andrew cooke

New submission from andrew cooke and...@acooke.org:

There are two related issues here.  The first is, I think, a simple bug:

When I try to register a function as a subclass of an ABC I get the error:
  TypeError: issubclass() arg 2 must be a class or tuple of classes

Looking at the code - 
http://svn.python.org/view/python/trunk/Lib/abc.py?annotate=72278 - it seems 
that instead the test at line 99 should have triggered a better error: 
TypeError(Can only register classes) 

In other words, line 99 should read:
  if not isinstance(subclass, type): 
(currently the code tests the self class, cls, which is pointless).


My second issue is that this shouldn't raise an error at all.  It should be 
possible for functions to be registered as subclasses of ABCs.  This would 
simplify some code of mine that uses functions and classes interchangeably, and 
I can see no real reason why it shouldn't work.  From the user's point of 
view, my library provides a bunch of things that all look the same (they are 
provided with arguments and do stuff).  Whether these are constructors or 
functions is irrelevant...  and yet my code has to handle constructors and 
functions differently simply because of the errors here.

What I suspect I will do is have my own hash table, and forget ABCs, but that 
is a pity because these functions really do work as constructors (they are 
factories) and so the idea of them being subclasses of an ABC helps clarify my 
code.

--
components: Library (Lib)
messages: 98387
nosy: acooke
severity: normal
status: open
title: Errors registering non-classes with ABCs
type: behavior
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7792
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7753] newgil backport

2010-01-26 Thread Ross Cohen

Ross Cohen rco...@snurgle.org added the comment:

On Fri, 22 Jan 2010 09:32:36 +
Marc-Andre Lemburg rep...@bugs.python.org wrote:

  * Please add the fallback solutions from the time module in case 
 gettimeofday() is not available. You cannot assume that all modern POSIX 
 systems implement that API - it was introduced in POSIX 2001 and Python 2.x 
 still supports OSes that were released prior to that year.

POSIX as a standard tends to follow, not lead. The gettimeofday() call
dates back over 20 years in BSD. time.time() falls back on ftime() and
then time(). ftime() was added to the POSIX spec at the same time as
gettimeofday() and is now deprecated. time() probably doesn't have
enough resolution.

I'd have to be pointed to a specific platform which doesn't support
gettimeofday() but which is supported by python. Otherwise, I'd be
coding blind.

Ross

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Here's the final version of the patch. After some testing on various platforms 
I'll commit it.

--
Added file: http://bugs.python.org/file16020/winver_as_structseq_ex4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7784] patch for making list/insert at the top of the list avoid memmoves

2010-01-26 Thread Adam Olsen

Adam Olsen rha...@gmail.com added the comment:

$ ./python -m timeit -s 'from collections import deque; c = 
deque(range(100))' 'c.append(c.popleft())'
100 loops, best of 3: 0.29 usec per loop

$ ./python -m timeit -s 'c = range(100)' 'c.append(c.pop(0))'
100 loops, best of 3: 0.424 usec per loop

Using flox's issue7784_listobject_perf.diff.  Significantly slower, but it does 
scale linearly.


$ ./python -m timeit -s 'c = range(100)' 'c.insert(0, c.pop())'
100 loops, best of 3: 3.39 msec per loop

Unfortunately inserting does not.  Will future patches attempt to address this?

Note that, if it ends up slower than list and slower than deque there isn't 
really a use case for it.

--
nosy: +Rhamphoryncus

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7784
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7784] patch for making list/insert at the top of the list avoid memmoves

2010-01-26 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Please take care in presenting timings.  It is easy to get misleading results:

* Factor-out the attribute lookup time (since that isn't the part being changed:

  -s 'c = range(100); c_ins=c.insert; c_pop=c.pop' 
  'c_insert(0, c_pop())'

* The case of alternately prepending and the popping the 0th element is 
atypical.  Trying prepending many, then popping many.   Trying popping first, 
then prepending.

* The patch needs to be throughly exercised so that we cover all of the 
expected behaviors (do many prepends trigger memmoves, do many prepops leave 
tons of unused space, what happens with the normal case of a moving queue where 
the average size varies but hovers around a typical mean).

A decision cannot be based on exercising a small fragment of a data structure 
on just the things it is good at.  What happens to other typical list behavior 
and lookup times, etc?

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7784
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7793] regrtest fails with RuntimeError: maximum recursion depth exceeded in some cases

2010-01-26 Thread Florent Xicluna

New submission from Florent Xicluna la...@yahoo.fr:

~ $ ./python -m test.regrtest -R 1:0: test_multibytecodec_support 
test_codecencodings_tw test_codecencodings_jp

test_multibytecodec_support
test_codecencodings_tw
test test_codecencodings_tw failed -- Traceback (most recent call last):
  File ./Lib/test/test_multibytecodec_support.py, line 88, in 
test_customreplace_encode
test.xmlcharnamereplace)[0], sout)
  File ./Lib/test/test_multibytecodec_support.py, line 74, in 
xmlcharnamereplace
if ord(c) in codepoint2name:
  File ./Lib/test/test_multibytecodec_support.py, line 260, in ord
return _ord(c)
  File ./Lib/test/test_multibytecodec_support.py, line 260, in ord
return _ord(c)
  File ./Lib/test/test_multibytecodec_support.py, line 260, in ord
return _ord(c)
(...)
RuntimeError: maximum recursion depth exceeded

test_codecencodings_jp
test test_codecencodings_jp failed -- multiple errors occurred; run in verbose 
mode for details
1 test OK.
2 tests failed:
test_codecencodings_jp test_codecencodings_tw

--
components: Tests
messages: 98392
nosy: flox
priority: normal
severity: normal
stage: test needed
status: open
title: regrtest fails with RuntimeError: maximum recursion depth exceeded in 
some cases
type: behavior
versions: Python 2.6, Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7793
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7753] newgil backport

2010-01-26 Thread Ross Cohen

Ross Cohen rco...@snurgle.org added the comment:

On Sat, 23 Jan 2010 18:23:10 +
Antoine Pitrou rep...@bugs.python.org wrote:

 By the way, the new GIL only works with POSIX and Windows NT threading APIs. 
 Perhaps it can't be backported at all to 2.x, given that 2.x supports more 
 threading APIs than py3k does?

Looking at the Python/thread_*.h files, it looks like py3k still
supports 9 different threading models. If that's accurate, it means
py3k trunk is broken on platforms which use cthread, lwp, os2, pth,
sgi, solaris and wince threading models. The 2.x series adds atheos and
beos to that list.

I think the right way to fix this is to extend the thread_*.h files to
have a proper abstraction for conditions which can be used by the
newgil work. Then the maintainers for more obscure platforms can fix
those instead of it all turning into a big mess in ceval_gil.h.

Ross

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1205239] Let shift operators take any integer value

2010-01-26 Thread Craig McQueen

Craig McQueen pyt...@craig.mcqueen.id.au added the comment:

Thanks, good points. I'm thinking with a C background and the fixed-width data 
types. The 0xFF could be needed if the data_byte is actually a larger number 
and you need to ensure only the lowest 8 bits are set. Or, if there is some 
sign-extending going on with the right-shift. That could happen in Python if 
the user passed a negative 'crc' in to the function (for whatever reason).

Yes, I'm missing a final mask. Thanks for pointing that out. I was thinking 
like a C programmer!

As for crc  8  crc_width... the 'crc  8' could bump an integer into long 
territory, making calculations slower. E.g.:

 2**23  8  16
32768L

 2**23  (16 - 8)
32768

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1205239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Committed in trunk r77763, in py3k r77765.

--
assignee:  - eric.smith
resolution:  - accepted
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7766
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1205239] Let shift operators take any integer value

2010-01-26 Thread Craig McQueen

Craig McQueen pyt...@craig.mcqueen.id.au added the comment:

To complete that thought...

Since crc  8 could bump the calculation into long territory, for that final 
mask I guess I'd want to mask and then shift. I.e. rather than

crc_mask = ((1  crc_width) - 1)
crc = (...) ^ ((crc  8)  crc_mask)

do:

crc_lower_mask = ((1  (crc_width - 8)) - 1)
crc = (...) ^ ((crc  crc_lower_mask)  8)

But that expression should evaluate to 0 if crc_width = 8, so I guess I'll 
need to special-case it. And if I special-case it, I don't need to shift by a 
negative value after all!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1205239
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7789] Issue using datetime with format()

2010-01-26 Thread Eric Smith

Changes by Eric Smith e...@trueblade.com:


--
assignee: eric.smith - georg.brandl
nosy: +georg.brandl

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7789
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7793] regrtest fails with RuntimeError: maximum recursion depth exceeded in some cases

2010-01-26 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7793
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7030] Update version{added, changed} entries in py3k unittest docs

2010-01-26 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

skip* functions are missing 'new in' documentation. These need to be correct 
for 2.7 and 3.1 / 3.2 as well.

Plus the example of assertRaises as a context manager sucks.

http://docs.python.org/dev/library/unittest.html#unittest.TestCase.assertRaises

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7030
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7785] FileIO.write() accepts Unicode strings

2010-01-26 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Oops. Fixed in r77781.

--
nosy: +benjamin.peterson
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7785
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7786] Is the BlockingIOError exception an aborted idea?

2010-01-26 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

The BufferedReader/Writer classes are supposed to handle this exception 
correctly, so presumably you could have RawIO class that raises this exceptions 
and use it with the io stack.

Since this bug report has no clear resolution, I'm closing it. Further 
discussion should happen on Python-dev I believe.

--
nosy: +benjamin.peterson
resolution:  - works for me
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7786
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7792] Errors registering non-classes with ABCs

2010-01-26 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Fixed first bug in r77789. The second issue is a separate feature request.

--
nosy: +benjamin.peterson
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7792
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7776] httplib.py: ._tunnel() broken

2010-01-26 Thread Cameron Simpson

Cameron Simpson c...@zip.com.au added the comment:

Well, following your description I've backed out my urllib2 test case to this:

  f = urllib2.urlopen('https://localhost/boguspath')
  os.system(lsof -p %d | grep IPv4 % (os.getpid(),))
  f = urllib2.urlopen(R)
  print f.read()

and it happily runs HTTPS through the proxy if I set the https_proxy envvar. So 
it's all well and good for the just do what the environment suggests use case.

However, my older test:

  U = urllib2.Request('https://localhost/boguspath')
  U.set_proxy('localhost:3128', 'https')
  f = urllib2.urlopen(R)
  print f.read()

still blows up with:

  File /opt/python-2.6.4/lib/python2.6/urllib2.py, line 381, in open
protocol = req.get_type()
  AttributeError: HTTPResponse instance has no attribute 'get_type'

Now, this is the use case for I have a custom proxy setup for this activity.

It seems a little dd that req above is an HTTPResponse instead of a Request, 
and that my be why there's no .ettype() method available.

I also see nothing obviously wrong with my set_proxy() call above based on the 
docs for the .set_proxy() method, though obviously it fails.

I think what may be needed is a small expansion of the section in the Examples 
are on proxies. There's an description of the use of the *_proxy envvars there 
(and not elsewhere, which seems wrong) and an example of providing a proxy 
Handler. An addition example with a functioning use of a bare .set_proxy() 
might help.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7776
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >