[issue8308] raw_bytes.decode('cp932') -- spurious mappings

2010-04-04 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

This mapping is in conformance with the de-facto standard of that encoding, 
Microsoft Windows, see

http://www.autumn.org/etc/unidif.html
http://mail.python.org/pipermail/i18n-sig/2003-June/001598.html
http://homepage1.nifty.com/nomenclator/perl/ShiftJIS-CP932-MapUTF.html

--
nosy: +loewis

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



[issue7583] doctest should normalize tabs when comparing output

2010-04-04 Thread R. David Murray

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

Having thought about it some more, I see why you did the patch the way you did.

The fact that there are two completely different ways to expand tabs in the 
output that are equally valid and have their advantages and disadvantages makes 
me wonder if this should be fixed at all.  Perhaps it is better to just say 
that you can only handle tabs in output by ignoring whitespace.

--
resolution: accepted - 

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



[issue7585] difflib should separate filename from timestamp with tab

2010-04-04 Thread R. David Murray

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

We could avoid the 7583 problem by making the doctests use NORMALIZE_WHITESPACE 
and moving the real *tests* into the unittests for the module.  I think that 
would be a good thing to do anyway.

--

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



[issue8309] Sin(x) is Wrong

2010-04-04 Thread Mark Dickinson

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

What Ilya Sandler said!

Computing sin or cos with large arguments requires high precision for the 
intermediate calculations (e.g., for sin(1e22) you'd need around 40 digits of 
precision for the reduction step), so most math libraries don't bother.  

This is also the reason that Intel's x87 FSIN instruction (which may or may not 
be being used here) requires that the argument be in the range -2**63 to 2**63.

Short of Python using its own math library, or adding a dependence on a 
correctly rounded math library like MPFR or crlibm, there's no real way to fix 
this.

Out of curiosity, what application do you have that requires evaluating sin for 
such large arguments?

--
resolution:  - wont fix
status: open - closed

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



[issue8300] Allow struct.pack to handle objects with an __index__ method.

2010-04-04 Thread Mark Dickinson

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

Probably both those conditions can't be satisfied;  I'm wasn't sure what 
happened if something's __index__ method returned something other than an int 
or long.

But now I bother to look at the source (in Objects/abstract.c) I see that there 
*is* already an explicit check for the result of nb_index being int or long 
(with TypeError being raised if the result isn't one of those).  Mea culpa.  
I'll remove those lines (though I may leave an assert, just to be on the safe 
side).

The 2.x behaviour isn't ideal:  I'd prefer to just stop if the __index__ method 
is present and raises TypeError, rather than going on to check __int__ in that 
case.  But that presents problems with old-style classes, where PyIndex_Check 
is true even when no __index__ method is explicitly defined.

Thanks for the extra tests!

--

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



[issue8300] Allow struct.pack to handle objects with an __index__ method.

2010-04-04 Thread Mark Dickinson

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

Committed (with some tabs in test_struct.py changed to spaces) to trunk in 
r79745.

--

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



[issue8300] Allow struct.pack to handle objects with an __index__ method.

2010-04-04 Thread Mark Dickinson

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

Merged to py3k in r79746.

Meador, does this all look okay, now?

--
resolution:  - accepted
stage: patch review - committed/rejected
status: open - pending

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



[issue8307] test_pep263 failure on OS X

2010-04-04 Thread Mark Dickinson

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

Yes, Benjamin's checkin seems to have fixed it for me, too.  Thanks, Benjamin!

There's still the issue of the Tkinter import changing the locale, but that 
seems to be out of Python's control.  As far as I can tell, it happens when the 
module initialization calls Tcl_FindExecutable, which is part of the Tcl 
library itself.  This may well be deliberate:  see

http://www.tcl.tk/cgi-bin/tct/tip/66.html

Closing.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
type:  - behavior

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



[issue8309] Sin(x) is Wrong

2010-04-04 Thread Derek O'Connor

Derek O'Connor derekrocon...@eircom.net added the comment:

Reply to Mark Dickinson

Python 3.1.2 -- 32 bit gives sin(2^60) = -0.7391806966492228
PariGp 2.3.4   gives sin(2^60) = -0.8306492176372546505752817956

So it seems Intel's x87 FSIN is not being used.

Application? I don't have one, but it is not too hard to imagine that buried 
deep in a large simulation, sin(x) is presented with a large argument, and 
whose wrong result is never noticed until ...

I quote from Ng's paper :
http://www.derekroconnor.net/Software/Ng--ArgReduction.pdf
--
It is often argued that being concerned  about  large  arguments
is  unnecessary, because sophisticated users simply know better 
than to compute with large  angles.  It  is  our contention that this position 
is suboptimal, because:

1. It places an unnecessary burden on the user.

2. The consequences of producing incorrect (inaccurate)answers
   may be catastrophic;  many people assume that computers can
   do arithmetic very well.  While  numerical  analysts know better,
   not all programmers are numerical analysts, nor should they be.

3. It is a vendors responsibility  to  provide  answers that
   are as correct as possible.
---

Derek O'Connor

--

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



[issue8304] strftime and Unicode characters

2010-04-04 Thread AndiDog

AndiDog andi...@web.de added the comment:

Just installed Python 3.1.2, same problem. I'm using Windows XP SP2 with two 
Python installations (2.6.4 and now 3.1.2).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8304
___
___
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

2010-04-04 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

What kind of signals can be received in real-life?
(I'm assuming that most signals are of the kind that you only receive if 
someone else deliberately sends it to you, in which case you are supposed to be 
prepared to handle it)

Also, does your patch still allow Python to handle the signal properly (invoke 
a registered signal handler, or perhaps raise KeyboardInterrupt)?

You could raise the issue on the python-dev mailing-list for more advice.

--
nosy: +exarkun, pitrou

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



[issue8308] raw_bytes.decode('cp932') -- spurious mappings

2010-04-04 Thread John Machin

John Machin sjmac...@users.sourceforge.net added the comment:

Thanks, Martin. Issue closed as far as I'm concerned.

--

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



[issue8304] strftime and Unicode characters

2010-04-04 Thread AndiDog

AndiDog andi...@web.de added the comment:

Definitely a Windows problem. I did this on Visual Studio 2008:

wchar_t out[1000];
time_t currentTime;
time(currentTime);
tm *timeStruct = gmtime(currentTime);

size_t ret = wcsftime(out, 1000, L%d%A, timeStruct);
wprintf(Lret = %d, out = (%s)\n, ret, out);

ret = wcsftime(out, 1000, L%d\u200f%A, timeStruct);
wprintf(Lret = %d, out = (%s)\n, ret, out);

and the output was

ret = 8, out = (04Sunday)
ret = 0, out = ()

Python really shouldn't use any so-called standard functions on Windows. They 
never work as expected ^^...

--
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8304
___
___
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

2010-04-04 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

In real life, you can receive for example SIGSTOP (strace, gdb, shell), but 
mostly SIGCHLD (any process spawning children), etc. The attached patch just 
restarts calls when EINTR is received, as is done in subprocess module. The 
mailing list is a good idea.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7978
___
___
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

2010-04-04 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@divmod.com added the comment:

 What kind of signals can be received in real-life?

There are lots of possible answers.  Here's one.  You launch a child process 
with os.fork() (and perhaps os.exec*() as well).  Eventually you'll get a 
SIGCHLD in the parent when the child exits.  If you've also installed a 
Python-level SIGCHLD handler with signal.signal (and not flagged the handler 
with SA_RESTART using signal.siginterrupt) then if you're in select.select() 
when the SIGCHLD is received, select.select() will fail with select.error EINTR.

If your Python SIGCHLD handler deals with the SIGCHLD completely before 
returning, then this lets you support child processes and use SocketServer at 
the same time.

Changing the behavior of select.select() (a fix at select level would be 
better) should be *very* carefully considered, and probably rejected after 
such consideration.  There are completely legitimate use cases which require 
select.select() to fail with EINTR, and these should remain supported (not to 
mention that existing code relying on this behavior shouldn't be broken by a 
Python upgrade in a quite insidious way).

--

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



[issue8310] dis.dis function skips new-style classes in a module

2010-04-04 Thread Ozgur Dogan Ugurlu

New submission from Ozgur Dogan Ugurlu dog...@gmail.com:

The documentation says:

dis.dis([bytesource])
Disassemble the bytesource object. bytesource can denote either a module, a 
class, a method, a function, or a code object. For a module, it disassembles 
all functions. For a class, it disassembles all methods. For a single code 
sequence, it prints one line per bytecode instruction. If no object is 
provided, it disassembles the last traceback.

And the behavior is correct for old-style classes. However, since the if check 
in the function dis.dis is like this:

if hasattr(x, '__dict__'):
items = x.__dict__.items()
items.sort()
for name, x1 in items:
if type(x1) in (types.MethodType,
types.FunctionType,
types.CodeType,
types.ClassType):

when given a module (x), it doesn't handle new-style classes which are 
types.TypeType. (types.ClassType are old-style classes)

A simple addition of types.TypeType to the list used by the inner if clause 
fixes the problem for me but I don't know if it could introduce another bug.

--
components: Library (Lib)
messages: 102338
nosy: dogeen
severity: normal
status: open
title: dis.dis function skips new-style classes in a module
type: behavior
versions: Python 2.6

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



[issue8308] raw_bytes.decode('cp932') -- spurious mappings

2010-04-04 Thread R. David Murray

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


--
resolution:  - wont fix
stage: test needed - committed/rejected
status: open - closed

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



[issue8188] Unified hash for numeric types.

2010-04-04 Thread Mark Dickinson

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

New patch:

 - document and test sys.hash_info
 - document numeric hash definition (in Doc/library/stdtypes.rst;  I'm
   not sure whether this is the best place for it)
 - document Decimal change (Decimal instances are now comparable
   with instances of float, fraction.Fraction)
 - refresh patch to apply cleanly to current svn.

I think this is close to final form:  I intend to apply this patch (or 
something very much like it) soon;  any review would be appreciated.

--
nosy: +rhettinger
stage:  - commit review
Added file: http://bugs.python.org/file16756/numeric_hash6.patch

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



[issue7696] Improve Memoryview/Buffer documentation

2010-04-04 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

 (I don't know why it doesn't have its own anchor, though)

Because that is only a link to the real description:

http://docs.python.org/dev/library/stdtypes.html#memoryview

And I think even you, Mr Potrou, could infer how to add glossary entries from 
one look at glossary.rst :)

--

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



[issue8188] Unified hash for numeric types.

2010-04-04 Thread Mark Dickinson

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

I've refreshed the Rietveld patch as well:

http://codereview.appspot.com/660042

--

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



[issue8311] wave module sets data subchunk size incorrectly when writing wav file

2010-04-04 Thread Jeff Pursell

New submission from Jeff Pursell jpurs...@gmail.com:

I tried to create a 4 second file and only heard the first 2 seconds.  The file 
size was correct for a 44.1 kHz, 16 bit mono file at 4 seconds, but both aplay 
and audactiy ignored the second half of the file.  I went to this page 
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ and opened the 
output with a hex editor in little endian mode.  I found that at offset 40, the 
data chunk size was wrong.  It looked like it was just set to the number of 
samples.  It should be the number of samples times bytes-per-sample (2) times 
number-of-channels (1 in my case).  I manually set the number from 176400 to 
352800 and that solved the problem for that wav file.

I'm guessing this was just an oversight and the fix will be simple.

I'll attach the code I used to generate the test tone.  Just run python -i 
testTone.py and it will generate out.wav with the incorrect field.

I am using pything 2.6.4 in ubuntu.

--
components: Extension Modules
files: testTone.zip
messages: 102342
nosy: Jeff.Pursell
severity: normal
status: open
title: wave module sets data subchunk size incorrectly when writing wav file
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file16757/testTone.zip

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



[issue8309] Sin(x) is Wrong

2010-04-04 Thread Tim Peters

Tim Peters tim.pet...@gmail.com added the comment:

At heart, this is really the same kind of thing that eventually prodded Python 
into adopting David Gay's burdensome ;-) code for correctly rounded 
double-string I/O conversions.  We could similarly take on porting and 
maintaining KC Ng's fdlibm (an open source libm implementation Ng developed 
while at Sun - it doesn't guarantee correct rounding, but does guarantee max 
error strictly less than 1 ULP in all cases).

The tradeoffs are roughly similar.  For example, fdlibm is typically much 
slower than the platform C's libm, and most people using math libraries in 
anger are much keener about speed than avoiding noise results for inputs in 
ranges they never intend to use.  Perhaps surprisingly, fdlibm isn't so slow 
primarily because it's aiming at max 1 ULP error, but because it was coded to 
be as portable as possible.  Platform-specific libm implementations play every 
trick in the book ( invented many of the tricks in the book to begin with!) to 
squeeze out every cycle from the specific hardware they're intended to run on.  
That makes fast versus accurate versus portable very much a pick at most 
two proposition for libm.

--
nosy: +tim_one

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



[issue8304] strftime and Unicode characters

2010-04-04 Thread Brian Curtin

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


--
versions:  -Python 3.3

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



[issue8309] Sin(x) is Wrong

2010-04-04 Thread Mark Dickinson

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

 We could similarly take on porting and maintaining KC Ng's fdlibm

Gulp.

If we did that, I'd definitely want to push for dropping Python support for 
non-IEEE 754 systems.

I'm not sure I've fully recovered from the dtoa.c addition yet.  :)

--

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



[issue8154] os.execlp('true') crashes the interpreter on 2.x

2010-04-04 Thread Paul Smith

Changes by Paul Smith paulsm...@pobox.com:


--
nosy: +paulsmith

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



[issue6931] dreadful performance in difflib: ndiff and HtmlDiff

2010-04-04 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

This is because difflib.ndiff (called by difflib.HtmlDiff.make_table), 
contrarily to difflib.unified_diff (and probably kdiff3), doesn't restrict 
itself to contiguous lines, and searches diff even inside lines, so the 
complexity is much worse (see how many times _fancy_replace and quick_ratio are 
being called).
It might be a good idea to allow the user to specify the type of diff needed 
(ndiff vs unified_diff).

--
nosy: +neologix

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



[issue8311] wave module sets data subchunk size incorrectly when writing wav file

2010-04-04 Thread Jeff Pursell

Jeff Pursell jpurs...@gmail.com added the comment:

Here's my fix.  The left file is the original and the right file is my version. 
 Perhaps someone should check this patch on a big endian machine to make sure 
there are no issues there.  I do not anticipate any issues.

416c416
 nframes = len(data) // (self._sampwidth * self._nchannels)
---
 nframes = len(data) // self._nchannels
427c427
 self._datawritten = self._datawritten + len(data)
---
 self._datawritten = self._datawritten + len(data) * 
 self._sampwidth
463c463
 self._nframes = initlength / (self._nchannels * self._sampwidth)
---
 self._nframes = initlength // self._nchannels

--

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



[issue8188] Unified hash for numeric types.

2010-04-04 Thread Stefan Krah

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

Mark, very nice concept! - I'm just starting to review the patch, but I
think the unsigned longs in_Py_HashDouble() and long_hash() should be
uint64_t on a 64-bit OS.

For instance, now on Windows 64-bit:

 hash(2**61-1)
1073741823

--

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



[issue8309] Sin(x) is Wrong

2010-04-04 Thread Derek O'Connor

Derek O'Connor derekrocon...@eircom.net added the comment:

@ Tim Peters

 ... are much keener about speed than avoiding noise results for inputs in 
ranges they *never intend to use* .

It is the *unintended use* that worries me. Sadly, Speed is King. Perhaps 
that aphorism should be Speed is Ki(lli)ng.

@ Mark Dickinson

I don't write C but Gay's 4300 line dtoa.c is the most frightening piece of 
code I've ever seen. 

I think accountants have the right idea: money is in cents, with positives in 
the left column and negatives in the right. All they need is integer addition 
and comparison. Multiplication? Only if you have taxation.

Derek O'Connor

--

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



[issue8311] wave module sets data subchunk size incorrectly when writing wav file

2010-04-04 Thread R. David Murray

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

Any chance you could create a unit test for this? (The current set of tests 
is...pretty minimal.)  Also, having the patch in unified diff format relative 
to the top of the source three would be helpful (although this one is small 
enough we could certainly apply it by hand, having a unified diff makes it more 
likely someone will test it).

--
components: +Library (Lib) -Extension Modules
nosy: +r.david.murray
priority:  - normal
stage:  - test needed

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



[issue8188] Unified hash for numeric types.

2010-04-04 Thread Stefan Krah

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

Actually the current long_hash() is affected as well. On Windows 64-bit:

 hash(2**31)
-2147483648

 hash(2**32)
1

--

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



[issue8035] urllib.request.urlretrieve hangs

2010-04-04 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

Alright, what happens is the following:
- the file you're trying to retrieve is actually redirected, so the server send 
a HTTP/1.X 302 Moved Temporarily
- in urllib, when we get a redirection, we call redirect_internal:
def redirect_internal(self, url, fp, errcode, errmsg, headers, data):
if 'location' in headers:
newurl = headers['location']
elif 'uri' in headers:
newurl = headers['uri']
else:
return
void = fp.read()
fp.close()
# In case the server sent a relative URL, join with original:
newurl = basejoin(self.type + : + url, newurl)
return self.open(newurl)

the fp.read() is there to wait for the remote end to close connection
The problem, in this case, is that with Python 3.1, httplib uses HTTP/1.1 
instead of HTTP/1.0 in version 2.6, and with HTTP/1.1 the server doesn't close 
the connection after sending the redirect (shown by tcpdump).
So, the process remains stuck on fp.read().
Now, in version 3.1, if we simply change Lib/http/client.py:628
from 
class HTTPConnection:

_http_vsn = 11
_http_vsn_str = 'HTTP/1.1'

to
class HTTPConnection:

_http_vsn = 11
_http_vsn_str = 'HTTP/1.0'

to use HTTP/1.0 instead, the retrieval works fine.

Obviously, this is not a good solution. Since the RFC doesn't seem to require 
the server to close the connection after sending a redirect, we'd probably 
better close the connection ourselves.

That's what the attached patch does, it simply removes the call to fp.read() 
before closing the connection. It also removes this for http_error_default, 
since if an error occurs, we probably want to close the connection as soon as 
possible instead of waiting for server to do so.

--
keywords: +patch
nosy: +neologix
Added file: http://bugs.python.org/file16758/urllib_redirect.diff

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



[issue8188] Unified hash for numeric types.

2010-04-04 Thread Mark Dickinson

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

Yes, hash values are C longs, regardless of platform.  I think that's probably 
too ingrained to consider changing it (we'd have to change hashes of all the 
non-numeric types, too).

--

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



[issue8312] Add post/pre hooks for distutils commands

2010-04-04 Thread Tarek Ziadé

New submission from Tarek Ziadé ziade.ta...@gmail.com:

Add hooks to a script can be launched before/after a command.

This will be useful to build pre/post commit hooks for install/uninstall 
commands for instance

--
assignee: tarek
components: Distutils2
messages: 102353
nosy: tarek
severity: normal
status: open
title: Add post/pre hooks for distutils commands

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



[issue8035] urllib.request.urlretrieve hangs

2010-04-04 Thread R. David Murray

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

@andyharrington: No, crash is when the interpreter segfaults.
I'm making it priority high, though, since it is a hang during an operation 
that is likely to happen fairly frequently.  Senthil may want to bump it up 
even higher.

@neologix: Thanks for figuring this out.

--
nosy: +orsenthil, r.david.murray
priority:  - high
stage:  - test needed
type: crash - behavior
versions: +Python 3.2

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



[issue8287] python-gdb.py triggers compile errors on FreeBSD and Solaris

2010-04-04 Thread R. David Murray

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

Hmm.  The patch didn't apply to my current trunk checkout.  I'll look into why 
later.

--
nosy: +r.david.murray

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




[issue7559] TestLoader.loadTestsFromName swallows import errors

2010-04-04 Thread Chris Jerdonek

Chris Jerdonek chris.jerdo...@gmail.com added the comment:

This patch implements Michael's suggestion (but not the ErrorHolder part):

http://bugs.python.org/issue7559#msg97462

The unit tests all pass with no change.  If this approach looks good to you, I 
can add a unit test to the patch that checks that this bug has been fixed.

Also, Twisted Matrix's web site doesn't seem to be responding too well at the 
moment, but if I recall correctly, their code has a permissive (MIT?) license 
that should allow a small snippet like this to be copied without taking extra 
steps.

--
Added file: http://bugs.python.org/file16759/_patch-7559-2.diff

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



[issue8310] dis.dis function skips new-style classes in a module

2010-04-04 Thread Benjamin Peterson

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

Fixed in r79769.

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

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



[issue8287] python-gdb.py triggers compile errors on FreeBSD and Solaris

2010-04-04 Thread Dave Malcolm

Dave Malcolm dmalc...@redhat.com added the comment:

I believe $(INSTALL_SCRIPT) was changed to $(INSTALL_DATA) in r79716 (see 
http://bugs.python.org/issue8032#msg102288 )

Attaching refreshed version of the patch.

--
Added file: 
http://bugs.python.org/file16760/introduce-var-for-gdb-hooks-002.patch

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



[issue1578269] Add os.symlink() and os.path.islink() support for Windows

2010-04-04 Thread Jason R. Coombs

Jason R. Coombs jar...@jaraco.com added the comment:

This latest patch (26) only merges the latest changes from the repo.

--
Added file: http://bugs.python.org/file16761/windows symlink draft 26.patch

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



[issue8287] python-gdb.py triggers compile errors on FreeBSD and Solaris

2010-04-04 Thread R. David Murray

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

Committed in r79778.  We'll see how the buildbots fare.

--
stage: patch review - commit review

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



[issue8300] Allow struct.pack to handle objects with an __index__ method.

2010-04-04 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

Looks good to me.

--
status: pending - open

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



[issue8218] Fix typos and phrasing in the Web servers howto

2010-04-04 Thread Ezio Melotti

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

Fixed in r79781 (trunk), r79782 (release26-maint), r79783 (py3k) and r79784 
(release31-maint).
Thanks to all!

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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8218
___
___
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

2010-04-04 Thread Vetoshkin Nikita

Vetoshkin Nikita nikita.vetosh...@gmail.com added the comment:

 What kind of signals can be received in real-life?

We use SIGUSR1 to reopen log files after rotation. sighandler works just fine, 
but after that Paste crashes.

I suppose that implementing silent syscall restart at select.select() level is 
a bad idea (explanation is given already), but some helper like untilConcludes 
in socket module might be useful.

--

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