[issue10046] Correction to atexit documentation

2010-10-07 Thread Georg Brandl

Georg Brandl  added the comment:

One could also argue that on SIGINT, the program is not "killed" but 
"interrupted" by the signal :)

What about "... killed by an unhandled signal ..."?

--
nosy: +georg.brandl

___
Python tracker 

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



[issue10040] GZipFile failure on large files

2010-10-07 Thread Ned Deily

Ned Deily  added the comment:

Since you mention 7-zip, does that mean you are seeing the problem on a Windows 
platform?  If so, exactly which version of Windows and what kind of system?  
Also, unless someone recognizes this as a duplicate of an earlier issue, there 
may not be much action on it unless you can supply a test case to reproduce the 
problem.

--
components: +Windows -Library (Lib)
nosy: +ned.deily
stage:  -> unit test needed

___
Python tracker 

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



[issue1777412] Python's strftime dislikes years before 1900

2010-10-07 Thread kiorky

kiorky  added the comment:

This patch doesnt apply anymore on py26.
Joining an updated patch.

--
Added file: http://bugs.python.org/file19157/strftime-pre-1900.patch

___
Python tracker 

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



[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu

Changes by kai zhu :


--
keywords: +patch
Added file: http://bugs.python.org/file19156/socket.makefile.newline.kwarg.patch

___
Python tracker 

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



[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu

kai zhu  added the comment:

my bad again, hacking newline parameter to the correct argument position works 
(its in the position where error should b).

a one line patch would be:

socket.py 
-text = io.TextIOWrapper(buffer, encoding, newline)
+text = io.TextIOWrapper(buffer, encoding, newline = newline)

--

___
Python tracker 

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



[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu

kai zhu  added the comment:

my bad for not rtfm, but it seems the newline argument has no effect in 
socket.makefile.

the TextIOWrapper signatures don't seem to match.  a hack to put newline 
parameter in 4th position or making it a keyword arg doesn't work either 
(scratch my head...)

socket.py source 
text = io.TextIOWrapper(buffer, encoding, newline)

textio.c 
static int
textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
{
char *kwlist[] = {"buffer", "encoding", "errors",
  "newline", "line_buffering",
  NULL};




$ python3 echo.py ## from previous example

$ python3 client.py 
b'hello\r\n' recv()
b'hello\r\n' makefile(mode = "rb")
'hello\n' makefile(mode = "r", newline = "")



# echo client program
data = b'hello\r\n'
import socket
clie = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
  clie.connect(('localhost', 12345))

  clie.send(data)
  data = clie.recv(4096)
  print(repr(data), 'recv()')

  clie.send(data)
  file = clie.makefile('rb')
  data = file.readline()
  print(repr(data), 'makefile(mode = "rb")')

  clie.send(data)
  file = clie.makefile('r', newline = '')
  data = file.readline()
  print(repr(data), 'makefile(mode = "r", newline = "")') ## '\r' is still 
silently dropped
finally:
  clie.close()

--
resolution: invalid -> 
status: closed -> open

___
Python tracker 

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



[issue4661] email.parser: impossible to read messages encoded in a different encoding

2010-10-07 Thread R. David Murray

R. David Murray  added the comment:

Here is an updated patch incorporating the reitveld feedback and feedback from 
python-dev about the API.  Now we have BytesParser instead of Parser with a 
parsebytes method, and a message_from_binary_file helper.  Generator also now 
converts bodies with an 8bit CTE into bodies with an appropriate 7bit coding.

Things still to do: (1) Add the (documented in this patch) BytesFeedParser 
class. (2) Figure out how to encode unknown bytes using the 'unknown' MIME 
charset in headers instead of replacing them with '?'s.  (3) Once I land a 
revised patch for issue 6302, add a flag to DecodedGenerator to have it fully 
decode headers.

I'd like to land this patch before Alpha3 if possible, so I'm setting it to 
release blocker for Georg to decide whether or not that is possible.  I'll 
complete the work in subsequent patches after the alpha, but everything needed 
to test the patch in field conditions is already present.

Georg, feel free to knock down the priority right away if you don't think it is 
ready or don't want to take time to even decide if it is ready :)

--
priority: high -> release blocker
Added file: http://bugs.python.org/file19155/email_parse_bytes7.diff

___
Python tracker 

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



[issue6825] Minor documentation bug with os.path.split

2010-10-07 Thread Evan Driscoll

Evan Driscoll  added the comment:

Hah, I totally forgot about this thing.

I'd suggest a change to the proposed patch. The patched version says:

  "In nearly all cases, ``join(head, tail)`` returns a location
   equivalent to *path* (the only exception being when there were 
   multiple slashes separating *head* from *tail*)."

Except now the parenthetical remark at the end of that sentence is a bit weird, 
because "a//a" != "a/a" is no longer an exception.

I'd suggest a wording such as one of the following, depending on where you want 
the emphasis (on the meaning of the return value of a path or on the actual 
contents of the return value as a string):

  "In all cases, ``join(head, tail)`` returns a location equivalent
   to *path*."

  "In most cases, ``join(head, tail)`` equals *path*; the
   exceptions to this are when there were multiple slashes
   separating *head* from *tail* or when *os.altsep* separators
   are replaced by *os.sep*."

The first suggestion could be followed by a remark "(but the strings may be 
unequal)" if you'd like.

I'd also replace "a location equivalent to" with "a path to the same location 
as" or something like that; "location" doesn't appear anywhere else on that 
page, and it seems slightly out of place to me.

--

___
Python tracker 

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



[issue10046] Correction to atexit documentation

2010-10-07 Thread Adam Olsen

Adam Olsen  added the comment:

Signals can directly kill a process.  Try SIGTERM to see this.  SIGINT is 
caught and handled by Python, which just happens to default to a graceful exit 
(unless stuck in a lib that prevents that.)  Try pasting your script into an 
interactive interpreter session and you'll see that it doesn't exit at all.

--

___
Python tracker 

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



[issue10047] python-2.6.6 coredump running newspipe

2010-10-07 Thread R. David Murray

R. David Murray  added the comment:

Can you reproduce this using python2.7?  Python 2.6 is in security fix only 
mode now.

--

___
Python tracker 

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



[issue10047] python-2.6.6 coredump running newspipe

2010-10-07 Thread R. David Murray

R. David Murray  added the comment:

Indeed, newspipe appears to be a pure python package, so this looks like it is 
probably a bug in python somewhere.

You might want to report it to newspipe too, though.  They are likely to be 
able to figure out how to reduce the problem to a minimum cause faster than we 
are.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue10046] Correction to atexit documentation

2010-10-07 Thread R. David Murray

R. David Murray  added the comment:

It is possible this behavior changed after the docs were written.  I'm adding a 
couple of people to nosy who might have some insight into that possibility.  It 
could be either a change in finalization procedures or a change in signal 
handling semantics, I think.

--
nosy: +Rhamphoryncus, pitrou, r.david.murray

___
Python tracker 

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



[issue4907] ast.literal_eval does not properly handled complex numbers

2010-10-07 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Fixed handling on unary minus in r85314.  In so doing, it also liberalized what 
literal_eval() accepts (3j+4 for example). This simplified the implementation 
and removed an unnecessary restriction which wasn't needed for "safety".

--
nosy: +rhettinger

___
Python tracker 

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



[issue6612] 'import site' fails when called from an unlinked directory

2010-10-07 Thread STINNER Victor

STINNER Victor  added the comment:

deleted_cwd.patch, patch based on labrat's patch updated to py3k:
http://www.physics.drexel.edu/~wking/code/hg/hgwebdir.cgi/python/rev/77f3ad10ba45

Procedure to test the patch:
 - go into Python source tree
 - make a directory "z"
 - enter z directory
 - delete the z directory (in another terminal)
 - run ../python

--
Added file: http://bugs.python.org/file19154/deleted_cwd.patch

___
Python tracker 

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



[issue6612] 'import site' fails when called from an unlinked directory

2010-10-07 Thread STINNER Victor

STINNER Victor  added the comment:

There was a bug in copy_absolute(): if _Py_wgetcwd() failed, the result was 
undefined (depending of the content of "path" buffer). Especially, absolutize() 
calls copy_absolute() with a buffer allocated on the stack: the content of this 
buffer depends on the undefined content of the stack.

Fixed in Python 3.2 (r85309+r85311), 2.7 (r85312) and 3.1 (r85313).

copy_absolute() is used (by calculate_path()) to fill sys.path.

--
nosy: +haypo

___
Python tracker 

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



[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file19147/realpath_fs_encoding.patch

___
Python tracker 

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



[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor

STINNER Victor  added the comment:

I just created Python/fileutils.c: update the patch for this new file.

--
Added file: http://bugs.python.org/file19153/realpath_fs_encoding-2.patch

___
Python tracker 

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



[issue10047] python-2.6.6 coredump running newspipe

2010-10-07 Thread Thomas Klausner

New submission from Thomas Klausner :

I'm running newspipe-1.1.9, an RSS reader
(http://newspipe.sourceforge.net/), on NetBSD-5.99.11/amd64 using
Python-2.6.6.

Sometimes, it core dumps with particular feeds in the configuration (I
guess depending on the feed, because when I comment out the offending
feed in the opml file, it runs through to completion).

The backtrace looks like this:
Core was generated by `python'.
Program terminated with signal 10, Bus error.
#0  0x7f7ffdc35a21 in PyOS_snprintf (str=0x7f7ff5dfe3d8 "@", size=120, 
format=0x1 ) at Python/mysnprintf.c:43
43  {
(gdb) bt
#0  0x7f7ffdc35a21 in PyOS_snprintf (str=0x7f7ff5dfe3d8 "@", size=120, 
format=0x1 ) at Python/mysnprintf.c:43
#1  0x7f7ffdc471a6 in PyOS_ascii_formatd (buffer=0x7f7ff5dfe3d8 "@", 
buf_size=120, format=0x7f7ff5dfe388 "%.2f", d=0.15256118774414062) at 
Python/pystrtod.c:455
#2  0x7f7ffdbaa7fa in formatfloat (buf=0x7f7ff5dfe3d8 "@", buflen=120, 
flags=16, prec=2, type=102, v=0x7f7ffcc6d510) at Objects/stringobject.c:4378
#3  0x7f7ffdbabd32 in PyString_Format (format=0x7f7ffc8144e0, 
args=0x7f7ffcc6d510) at Objects/stringobject.c:4943
#4  0x7f7ffdbaa3b0 in string_mod (v=0x7f7ffc8144e0, w=0x7f7ffcc6d510) at 
Objects/stringobject.c:4116
#5  0x7f7ffdb459db in binary_op1 (v=0x7f7ffc8144e0, w=0x7f7ffcc6d510, 
op_slot=32) at Objects/abstract.c:917
#6  0x7f7ffdb45c81 in binary_op (v=0x7f7ffc8144e0, w=0x7f7ffcc6d510, 
op_slot=32, op_name=0x7f7ffdc6c089 "%") at Objects/abstract.c:969
#7  0x7f7ffdb467ad in PyNumber_Remainder (v=0x7f7ffc8144e0, 
w=0x7f7ffcc6d510) at Objects/abstract.c:1221
#8  0x7f7ffdc08a03 in PyEval_EvalFrameEx (f=0x7f7fefa1dab0, throwflag=0) at 
Python/ceval.c:1180
#9  0x7f7ffdc1175f in fast_function (func=0x7f7ff8a9bed8, 
pp_stack=0x7f7ff5dfeae8, n=1, na=1, nk=0) at Python/ceval.c:3836
#10 0x7f7ffdc11565 in call_function (pp_stack=0x7f7ff5dfeae8, oparg=1) at 
Python/ceval.c:3771
#11 0x7f7ffdc0d81f in PyEval_EvalFrameEx (f=0x7f7fee920420, throwflag=0) at 
Python/ceval.c:2412
#12 0x7f7ffdc0f715 in PyEval_EvalCodeEx (co=0x7f7ffcc247b0, 
globals=0x7f7ffd1c5880, locals=0x0, args=0x7f7ff5b0aac8, argcount=8, 
kws=0x7f7ff5b0ab08, kwcount=0, defs=0x7f7ff8d3c4e8,
defcount=5, closure=0x0) at Python/ceval.c:3000
#13 0x7f7ffdc1184a in fast_function (func=0x7f7ff8a9cc80, 
pp_stack=0x7f7ff5dfeff8, n=8, na=8, nk=0) at Python/ceval.c:3846
#14 0x7f7ffdc11565 in call_function (pp_stack=0x7f7ff5dfeff8, oparg=7) at 
Python/ceval.c:3771
#15 0x7f7ffdc0d81f in PyEval_EvalFrameEx (f=0x7f7ff5b0a820, throwflag=0) at 
Python/ceval.c:2412
#16 0x7f7ffdc1175f in fast_function (func=0x7f7ff8a9e140, 
pp_stack=0x7f7ff5dff358, n=1, na=1, nk=0) at Python/ceval.c:3836
#17 0x7f7ffdc11565 in call_function (pp_stack=0x7f7ff5dff358, oparg=0) at 
Python/ceval.c:3771
#18 0x7f7ffdc0d81f in PyEval_EvalFrameEx (f=0x7f7ff5b0a420, throwflag=0) at 
Python/ceval.c:2412
#19 0x7f7ffdc1175f in fast_function (func=0x7f7ffca1db90, 
pp_stack=0x7f7ff5dff6b8, n=1, na=1, nk=0) at Python/ceval.c:3836
#20 0x7f7ffdc11565 in call_function (pp_stack=0x7f7ff5dff6b8, oparg=0) at 
Python/ceval.c:3771
#21 0x7f7ffdc0d81f in PyEval_EvalFrameEx (f=0x7f7ff5b03190, throwflag=0) at 
Python/ceval.c:2412
#22 0x7f7ffdc0f715 in PyEval_EvalCodeEx (co=0x7f7ffca0d4e0, 
globals=0x7f7ffca473a0, locals=0x0, args=0x7f7ff04d3e68, argcount=1, kws=0x0, 
kwcount=0, defs=0x0, defcount=0, closure=0x0)
at Python/ceval.c:3000
#23 0x7f7ffdb7a612 in function_call (func=0x7f7ffca1daa0, 
arg=0x7f7ff04d3e50, kw=0x0) at Objects/funcobject.c:524
#24 0x7f7ffdb495e8 in PyObject_Call (func=0x7f7ffca1daa0, 
arg=0x7f7ff04d3e50, kw=0x0) at Objects/abstract.c:2492
#25 0x7f7ffdb5eca0 in instancemethod_call (func=0x7f7ffca1daa0, 
arg=0x7f7ff04d3e50, kw=0x0) at Objects/classobject.c:2579
#26 0x7f7ffdb495e8 in PyObject_Call (func=0x7f7ff8ac2a00, 
arg=0x7f7ffd112050, kw=0x0) at Objects/abstract.c:2492
#27 0x7f7ffdc10cd3 in PyEval_CallObjectWithKeywords (func=0x7f7ff8ac2a00, 
arg=0x7f7ffd112050, kw=0x0) at Python/ceval.c:3619
#28 0x7f7ffdc4e69f in t_bootstrap (boot_raw=0x7f7ffd1b4590) at 
./Modules/threadmodule.c:428
#29 0x7f7ffd90ba32 in pthread_setcancelstate () from 
/usr/lib/libpthread.so.1
#30 0x7f7ffd26e9b0 in ___lwp_park50 () from /usr/lib/libc.so.12
#31 0x in ?? ()
(gdb) fr 1
#1  0x7f7ffdc471a6 in PyOS_ascii_formatd (buffer=0x7f7ff5dfe3d8 "@", 
buf_size=120, format=0x7f7ff5dfe388 "%.2f", d=0.15256118774414062) at 
Python/pystrtod.c:455
455 PyOS_snprintf(buffer, buf_size, format, d);
(gdb) l
450 format = tmp_format;
451 }
452
453
454 /* Have PyOS_snprintf do the hard work */
455 PyOS_snprintf(buffer, buf_size, format, d);
456
457 /* Do various fixups on the return string */
458
459 /* Get the current locale, and find the decimal point string.
(gdb) p format
$1 = 0x7f7ff5dfe388 "%.2f"
(gdb) fr 0
#0  0x000

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

As Eric said. Please see the socket.makefile doc:

“Return a file object associated with the socket. The exact returned type 
depends on the arguments given to makefile(). These arguments are interpreted 
the same way as by the built-in open() function.”

(http://docs.python.org/py3k/library/socket.html#socket.socket.makefile)

And in turn, the built-in open() function des cribes the `newline` parameters, 
which sets whether newline characters are translated.

--
nosy: +pitrou
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue6825] Minor documentation bug with os.path.split

2010-10-07 Thread Sandro Tosi

Sandro Tosi  added the comment:

Hello,
I find the proposed text change good, and so here's a patch to add that in a 
bit different format (sorry it's quite of a mess, but I took the occasion to 
wrap that paragraph to 80th column).

Regards,
Sandro

--
keywords: +patch
nosy: +sandro.tosi
Added file: http://bugs.python.org/file19152/issue6825-py3k.patch

___
Python tracker 

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



[issue10045] poor cStringIO.StringO seek performance

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I don't think there's much point in fixing this. 2.7 users can use io.BytesIO, 
which is a fast type implemented in C.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

> For the record, a Py_uintptr_t version works and has the same
> performance. Would you agree to it or is there still some menacing 
> oddity from the i386 days lurking around?

Technically, it's still dodgy:  as the gcc manual notes in:

http://gcc.gnu.org/onlinedocs/gcc/Arrays-and-pointers-implementation.html#Arrays-and-pointers-implementation

". That is, one may not use integer arithmetic to avoid the undefined behavior 
of pointer arithmetic as proscribed in C99 6.5.6/8."

I can't see as much scope for problems with the uintptr_t version.  But just 
because I can't anticipate the problems, it doesn't mean they don't exist.

It really would be better to avoid the undefined behaviour if at all possible.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

For the record, a Py_uintptr_t version works and has the same performance. 
Would you agree to it or is there still some menacing oddity from the i386 days 
lurking around?

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> In other words, when producing code for ptr_compare, the compiler is
> allowed to *assume* that a and b point into the same array, and act
> accordingly.

But this assumption doesn't bring *anything*, right?
That is, there is no shortcut way to compute "p - q" or "p > q" when
both point into the same "array".

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> See the example above:  suppose that a compiler is looking at a (p >=
> q) comparison of pointers.  Suppose furthermore that in a particular
> case that compiler is smart enough to figure out that q is a pointer
> to the start of an array.

Which array? You can have arrays everywhere in memory, at any address,
ending anywhere.

union {
   struct {
  char ch1;
  char arr1[2];
   }
   struct {
  char arr2[2];
  char ch2;
   }
   struct {
  char arr3[3];
   }
}

Which is an array, and which is not? is &ch1 an array? and arr1? and
arr2+1? Why would the compiler choose one over another? And what about
arrays defined in other modules?

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

> How is the compiler supposed to know whether a and b belong to the same
> array when compiling ptr_compare?

It doesn't need to know.  So long as the compiler can guarantee that its code 
will produce correct results in the case that a and b *do* both point to the 
same array, that's enough.  In other words, when producing code for 
ptr_compare, the compiler is allowed to *assume* that a and b point into the 
same array, and act accordingly.

--

___
Python tracker 

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



[issue10046] Correction to atexit documentation

2010-10-07 Thread Jason Baker

New submission from Jason Baker :

There's an issue with the documentation on the atexit module[1].  It states:

"Note: the functions registered via this module are not called when the program 
is killed by a signal, when a Python fatal internal error is detected, or when 
os._exit() is called."

This isn't necessarily true.  For instance, if I start the following script:

from atexit import register
from time import sleep

@register
def end():
print 'atexit'

while True:
sleep(1)

...and then do a "kill -SIGINT ", the atexit function gets called.  It 
would be helpful to have a more detailed description of the rules on how this 
works.

[1] http://docs.python.org/library/atexit.html#module-atexit

--
assignee: d...@python
components: Documentation
messages: 118141
nosy: Jason.Baker, d...@python
priority: normal
severity: normal
status: open
title: Correction to atexit documentation
versions: Python 2.7

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> In the bad old days of 386 segment:offset memory architectures this
> was a problem. You could have overlapping segments but pointers inside
> an object were always in the same segment, so the segment selectors
> never had to be inspected. Pointers to different objects could indeed
> have the same offset and would compare equal.

AFAIK it caused lots of other problems much more annoying than just
pointer compares, and programmers had to juggle by hand with various
addressing modes (near, far, etc.).

ISTM that all C programs nowadays assume some kind of flat, paged memory
model, CPython included; I don't think we have to fear some i386-like
segmentation model.

> We should follow the standard here: no comparisons between pointers to
> different arrays (basically).

Again, what is an "array" supposed to be? In memory there are no
"arrays".

Let's say I have the following function in a module:

int ptr_compare(char *a, char *b)
{
   return a > b;
}

and another module, the following function

int foo()
{
static char x[5];
static char y[6];
return ptr_compare(x + 2, y + 3);
}

How is the compiler supposed to know whether a and b belong to the same
array when compiling ptr_compare?

Otherwise, we could cast to Py_uintptr_t.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

See the example above:  suppose that a compiler is looking at a (p >= q) 
comparison of pointers.  Suppose furthermore that in a particular case that 
compiler is smart enough to figure out that q is a pointer to the start of an 
array.  Then the compiler is *permitted to assume* that p also points into the 
same array, since if it didn't then the code would introduce undefined 
behaviour.  And since q is the start of the array, and p is (by assumption) a 
pointer into the same array, p >= q will automatically be true, so the compiler 
is free to replace the expression with the integer '1' (i.e., true).

gcc does similar things with checks like (x + 1 > x):  if x is a (signed) int, 
then gcc can and will optimize (x + 1 > x) to 'true', on the basis that x + 1 
can never overflow, because such overflow would be undefined behaviour and 
therefore can't occur in a valid C program.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Eric Smith

Eric Smith  added the comment:

In the bad old days of 386 segment:offset memory architectures this was a 
problem. You could have overlapping segments but pointers inside an object were 
always in the same segment, so the segment selectors never had to be inspected. 
Pointers to different objects could indeed have the same offset and would 
compare equal.

We should follow the standard here: no comparisons between pointers to 
different arrays (basically).

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> > How can the compiler tell whether two pointers are "into the same
> > array"? That sounds like an undecidable criterion.
> 
> It doesn't have to be able to tell---it's allowed to assume.  :-)

That doesn't very clear or understandable.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

> How can the compiler tell whether two pointers are "into the same
> array"? That sounds like an undecidable criterion.

It doesn't have to be able to tell---it's allowed to assume.  :-)

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Nope.  It's only well-defined for pointers pointing into the same
> array (or to one past the end of an array).  Otherwise it's undefined
> behaviour.

How can the compiler tell whether two pointers are "into the same
array"? That sounds like an undecidable criterion.

--

___
Python tracker 

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



[issue6417] multiprocessing Process examples: print and getppid

2010-10-07 Thread Sandro Tosi

Sandro Tosi  added the comment:

Hello,
indentation problem has been fixed in r79901 and py3k syntax has been fixed in 
r74764.

wrt os.getppid(), in the documentation it's stated that with 3.2 it added 
support for windows too: I'd like someone running a windows box (I don't have a 
win system anywhere near to me) to check if the mp example works correctly as 
it is.

Regards,
Sandro

--
nosy: +sandro.tosi
versions: +Python 3.2 -Python 3.1

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

> I can't say anything about the standard, but p > q looks like it should
> be the same as (p - q) > 0

Yep.

> which looks rather well-defined for pointers.

Nope.  It's only well-defined for pointers pointing into the same array (or to 
one past the end of an array).  Otherwise it's undefined behaviour.

See section 6.5.6, paragraph 9, of

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Technically arbitrary relational comparisons of pointers are undefined,
> but in practice Antoine's assumptions here are very modest.

I disagree:  there's a very real practical danger here.  Namely, optimizing 
compilers are free to assume that code doesn't involve any undefined behaviour 
and optimize accordingly.  gcc for one is known to make extensive use of this 
freedom.  I wouldn't be at all surprised to find some current or future version 
of gcc optimizing an (p >= start_of_array) check to 'always true', on the basis 
that it *will* always be true in legal code.

Please don't introduce undefined behaviour here---it's asking for trouble.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> How does performance change if you adjust NSMALLPOSINTS and
> NSMALLNEGINTS, but make no other changes?

It makes a very small difference (which is understandable since it doesn't cut 
down on code execution a lot).

--

___
Python tracker 

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



[issue7285] multiprocessing module, example code error

2010-10-07 Thread Sandro Tosi

Sandro Tosi  added the comment:

Hello,
i've verified that the problem still exists in an up-to-date py3k branch, and 
that the proposed patch indeed fixes the bug.

Since the patch no more applies cleanly, I've refreshed it, and also added 
additional information about authkey that it must be a byte string.

Regards,
Sandro

--
nosy: +sandro.tosi
Added file: http://bugs.python.org/file19151/issue7285-py3k.patch

___
Python tracker 

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



[issue10029] "Equivalent to" code for zip is wrong in Python 3

2010-10-07 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I'll update the docs with an equivalent that works and that has a comment 
showing when the StopIteration is raised and caught.

--

___
Python tracker 

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



[issue10042] total_ordering stack overflow

2010-10-07 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Thanks, this is a good idea.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Technically arbitrary relational comparisons of pointers are
> undefined, but in practice Antoine's assumptions here are very modest.
> They boil down to:
> 
>v >= &array[0] && v < &array[array_len]

I can't say anything about the standard, but p > q looks like it should
be the same as (p - q) > 0, which looks rather well-defined for
pointers.

(at worse we could cast to _Py_uintptr_t, hopefully the compiler
wouldn't produce any different code)

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Aahz

Changes by Aahz :


--
nosy:  -Aahz, aahz

___
Python tracker 

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



[issue10045] poor cStringIO.StringO seek performance

2010-10-07 Thread R. David Murray

R. David Murray  added the comment:

I'm changing the versions to just 2.7 (though I'm not sure this can be 
considered a bug fix), since StringIO is reimplemented as part of io in 3.x.

--
nosy: +r.david.murray
versions:  -Python 2.6, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue10045] poor cStringIO.StringO seek performance

2010-10-07 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +pitrou

___
Python tracker 

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



[issue2142] difflib.unified_diff(...) produces invalid patches

2010-10-07 Thread Trent Mick

Trent Mick  added the comment:

c.f. some discussion on python-dev here:
http://mail.python.org/pipermail/python-dev/2010-October/104501.html

--

___
Python tracker 

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



[issue10045] poor cStringIO.StringO seek performance

2010-10-07 Thread Patrick Strawderman

Patrick Strawderman  added the comment:

The second sentence should have said "the gap is filled in with n null bytes"

--

___
Python tracker 

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



[issue10045] poor cStringIO.StringO seek performance

2010-10-07 Thread Patrick Strawderman

Changes by Patrick Strawderman :


--
components:  -None

___
Python tracker 

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



[issue10045] poor cStringIO.StringO seek performance

2010-10-07 Thread Patrick Strawderman

Changes by Patrick Strawderman :


--
components: +None
type:  -> performance

___
Python tracker 

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



[issue10045] poor cStringIO.StringO seek performance

2010-10-07 Thread Patrick Strawderman

New submission from Patrick Strawderman :

cStringIO.StringO's seek method has O(n) characteristics in certain,
albeit pathological, cases, while the pure Python implementation and
cStringIO.StringI's seek methods both execute in constant time in all cases.

When the file offset is set n bytes beyond the end of actual data,
the gap is filled in with n bytes in cStringIO.StringO's seek method.

however, POSIX states that reads of data in the gap will return null bytes
only if a subsequent write has taken place, so filling in the gap is not
required at the time of the seek.

This patch for 2.7 corrects the behavior by unifying StringO and StringI's
seek methods, and moving the writing of null bytes to StringO's write
method.  There may be a more elegant way to write this, I don't know.
I believe this issue affects Python 3 as well, though I have yet to
test it.

NOTE: Perhaps this seems like an extreme edge case not worthy of a fix, but
this actually caused problems for us when parsing images with malformed
EXIF data; a web request for uploading such a photo was taking on the order
of 15 minutes.  When we stopped using cStringIO.StringO, it took seconds.

--
files: cStringIO.diff
keywords: patch
messages: 118123
nosy: boogenhagn
priority: normal
severity: normal
status: open
title: poor cStringIO.StringO seek performance
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file19150/cStringIO.diff

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Eric Smith

Changes by Eric Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue10029] "Equivalent to" code for zip is wrong in Python 3

2010-10-07 Thread Max

Max  added the comment:

Personally, I find it impossible in some cases to understand exactly what a 
function does just from reading a textual description. In those cases, I always 
refer to the equivalent code if it's given. In fact that's the reason I was 
looking going the zip equivalent function!

I would feel it's a loss if equivalent code disappear from the docs.

I understand sometimes the code requires maintenance, but I'd rather live with 
some temporary bugs than lose the equivalent code.

As to subtleties of how it works, that's not really a concern, if that's the 
only way to understand the precise meaning of whatever it explains.

--

___
Python tracker 

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



[issue5870] subprocess.DEVNULL

2010-10-07 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc :


--
stage:  -> needs patch

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

> I don't think arbitrary comparisons of pointers give well-defined
> results, unless those pointers both happen to point into the same
> array.  (Might be wrong;  I don't have a copy of the C standard to
> hand.)

Technically arbitrary relational comparisons of pointers are undefined, but in 
practice Antoine's assumptions here are very modest.  They boil down to:

   v >= &array[0] && v < &array[array_len]

It is hard for me to imagine a system designed such that the expression  could 
evaluate to true when v is not in the array.

I suppose a system could be designed where relational comparisons of unrelated 
data pointers causes a segmentation fault or similar, but that also seems 
unlikely to me.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Maybe we could consider adding an extra field to a PyLong giving its
> 'small_int' value for small values, and some flag value for non-small
> longs.  An extra field wouldn't actually enlarge the size of a PyLong
> for small values---on a 64-bit machine, a value like 23L takes 28
> bytes, for which 32 bytes will actually be allocated (since Python
> always allocates in multiples of 8 bytes, I believe).

I actually had a patch for that. It declared a ob_digit[2] array instead
of ob_digit[1], and ob_digit[1] contained the small int. But the patch
still used the pointer comparison approach for PyLong_IS_SMALL_INT,
because I think it's faster (just two comparisons). So there didn't seem
to much point.

Also, the pointer addition trick for addition (see BINARY_ADD) is
probably faster than the more intuitive method.

--

___
Python tracker 

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



[issue8293] HTTPSConnection.close() does not immediately close the connection.

2010-10-07 Thread PoltoS

PoltoS  added the comment:

By the way, doing a sock.shutdown(socket.SHUT_RDWR) with a subsequent 
sock.close() helps to really close an SSL socket. But this may raise additional 
errors with subsequent close() since on some OS (like OS X) shutdown may close 
the socket. Am I right?

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

Maybe we could consider adding an extra field to a PyLong giving its 
'small_int' value for small values, and some flag value for non-small longs.  
An extra field wouldn't actually enlarge the size of a PyLong for small 
values---on a 64-bit machine, a value like 23L takes 28 bytes, for which 32 
bytes will actually be allocated (since Python always allocates in multiples of 
8 bytes, I believe).

--

___
Python tracker 

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



[issue8293] HTTPSConnection.close() does not immediately close the connection.

2010-10-07 Thread PoltoS

PoltoS  added the comment:

I've the with module ssl. If I do sock.close() (sock is instance of 
ssl.SSLSocket), the connection is not closed: I see it as Established in 
netstat and nothing is sent over network: tcpdump show nothing going thru the 
network.

Python 2.6.5
Linux Ubuntu

--
nosy: +PoltoS
status: pending -> open

___
Python tracker 

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



[issue10029] "Equivalent to" code for zip is wrong in Python 3

2010-10-07 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

> I suggest removing the "equivalent to" code from the zip section and
> replacing it with an example showing how to use zip with a for loop
> similar to the example illustrating enumerate.

+1

--

___
Python tracker 

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



[issue10029] "Equivalent to" code for zip is wrong in Python 3

2010-10-07 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

As Daniel pointed out, the "equivalent to" code in builtins section comes from 
2.x itertools documentation where and equivalent generator definition is 
presented for each function.  While these definitions are helpful when used for 
documenting a module oriented towards more advanced users, I doubt that 
exposing novices who are looking up builtins to the yield keyword and 
generators is a good idea.  The zip() example is particularly problematic.  
Conceptually, zip is a very simple function, but the "equivalent to" code is 
not easy to decipher.   The reliance on StopIteration exception escaping from 
map to break out of the infinite loop is clever, but not obvious.  Moreover, as 
this bug demonstrates, this trick relies on subtle details that changed in 3.x.

I suggest removing the "equivalent to" code from the zip section and replacing 
it with an example showing how to use zip with a for loop similar to the 
example illustrating enumerate.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

+#define _PyLong_IS_SMALL_INT(v) \
+(((PyLongObject *)(v)) >= _PyLong_small_ints && \
+ ((PyLongObject *)(v)) < _PyLong_SMALL_INTS_END)
+/* These macros purposedly avoid a cast to int, since it is most of time
+   useless, and sometimes detrimental (because of truncation).
+   XXX _PyLong_AS_SMALL_INT might be slower if sizeof(PyLongObject) is not
+   a power of two.
+   */

Urk!  This is nasty.  :(

I don't think arbitrary comparisons of pointers give well-defined results, 
unless those pointers both happen to point into the same array.  (Might be 
wrong;  I don't have a copy of the C standard to hand.)

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

Looks like a nice idea, at first glance, though I haven't looked at the code in 
detail.  I like the use of the macros to abstract away the long implementation 
details.

"INPLACE_SUBTRACT_end", not "INPLACE_SUBSTRACT_end", please!

--

___
Python tracker 

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



[issue10030] Patch for zip decryption speedup

2010-10-07 Thread R. David Murray

R. David Murray  added the comment:

It is what is normally done *now* when there is both a C and a python 
implementation (see, for example, test_datetime.py and test_io.py for two 
different approaches to that).  Not all tests have been updated to this 
practice.

Thanks for working on this.

--

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

How does performance change if you adjust NSMALLPOSINTS and NSMALLNEGINTS, but 
make no other changes?

--

___
Python tracker 

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



[issue10042] total_ordering stack overflow

2010-10-07 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue10030] Patch for zip decryption speedup

2010-10-07 Thread Shashank

Shashank  added the comment:

I have updated the patch with a check for the availability of C impl and to use 
pure-py impl as a fallback.

How do you suggest would the tests change? As I had mentioned before, in my 
understanding since there is no change in the API the already existing tests 
should work.

One can simulate the absence of C impl in a system where it is present but 
AFAIU this is not what it is usually done (e.g, in the case of optional zlib 
dependency in the same module)

--
Added file: http://bugs.python.org/file19149/zipdecrypt.patch

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Arithmetic with void* pointers is not allowed by the Microsoft compilers. char* 
should be used instead.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue10043] UnboundLocalError with local variable set by setattr, caused by code run later

2010-10-07 Thread Steven Samuel Cole

Steven Samuel Cole  added the comment:

thank you very much for the clarification.

i did indeed not come across the page you've linked to, mainly because i did 
not really know what to google for. actually, i do not recall ever looking into 
the python language reference in 6+ years of python coding.

googling for 'python UnboundLocalError setattr' returns this bug report as top 
result at the moment, as your link leads to more indepth information, the main 
objective of saving / alleviating others the research work seems achieved. i 
will nonetheless try to make time to get get my head around the python doc 
conventions and processes and submit a patch.

thanks for pointing out the difference between a local variable and one with 
module scope. however, it is not relevant for my situation: i have a long list 
of strings coming in (database column names, not under my influence) which i 
need to access _like_ a local variable. if you can think of a smarter approach 
to turn parameter strings into variables of whatever scope, i'm all ears, but i 
have a feeling that's actually what setattr(...) is meant for.
 
as a quick fix for the UnboundLocalError, sticking to working with module 
attributes worked for me. instead of changing the value of a dynamically 
created variable in the conventional way
  my_var = None
(which is where the error occurred in my code), it might help to use 
setattr(...) even if the variable name is known:
  setattr(modules[__name__], 'my_var', None)

--

___
Python tracker 

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



[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread Eric Smith

Eric Smith  added the comment:

Isn't this just the normal universal newline handling? When you open it in 
binary mode you see all of the characters, but in text mode (the absence of 
"b") you get normalized newlines (that is, they're converted to "\n").

--
components:  -2to3 (2.x to 3.0 conversion tool)
nosy: +eric.smith

___
Python tracker 

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



[issue10043] UnboundLocalError with local variable set by setattr, caused by code run later

2010-10-07 Thread Eric Smith

Eric Smith  added the comment:

It's a well documented behavior.

Surely you ran across this link while researching your problem? 
http://docs.python.org/reference/executionmodel.html#naming-and-binding
The paragraph beginning "The following constructs bind names ..." describes why 
setattr does not create a binding, although I'll grant that it doesn't mention 
setattr by name. The paragraph beginning "If a name binding operation occurs 
anywhere within a code block ..." explains why the assignment affects code that 
occurs before the binding.

If you'd like to improve the docs, please suggest a patch.

Also note that you're not creating a local variable with setattr, you're 
creating a module level (sometimes called global) variable. Perhaps that's part 
of the misunderstanding? You might want to look into the global (on nonlocal) 
statement, unless there's some particular reason the name you're creating needs 
to be dynamically computed.

--
assignee:  -> d...@python
components: +Documentation -Interpreter Core
nosy: +d...@python
resolution: invalid -> 
stage:  -> needs patch
status: closed -> open
versions: +Python 3.2 -Python 2.6

___
Python tracker 

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



[issue10043] UnboundLocalError with local variable set by setattr, caused by code run later

2010-10-07 Thread Steven Samuel Cole

Steven Samuel Cole  added the comment:

I'm just a developer, I don't know anything about Python internals or what 
Python sees or does at what stage.

Looking at the sample file, code executed later has an influence on code 
executed earlier - and that behavior is unexpected, confusing, bizarre, no 
matter what expert explanations there are.

It took me a while to isolate this problem, thought I report it here to save 
others the effort. This should at least be mentioned in the docs somewhere 
around setattr(...).

I think it is premature to declare this report invalid and close the bug - but 
hey, if _you_ are not interested in improving Python wherever possible, why 
would _I_ be ?

--

___
Python tracker 

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



[issue9800] Fast path for small int-indexing of lists and tuples

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I think the approach in issue10044 is better.

--
status: open -> pending

___
Python tracker 

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



[issue10044] small int optimization

2010-10-07 Thread Antoine Pitrou

New submission from Antoine Pitrou :

This is an experimental patch to optimize some operations on small ints.
pystone is 5-10% faster, pybench 2-3% faster, and here are some relevant 
benchmarks from unladen swallow:

### nbody ###
Min: 0.345136 -> 0.317502: 1.09x faster
Avg: 0.346827 -> 0.319561: 1.09x faster
Significant (t=79.50)
Stddev: 0.00140 -> 0.00198: 1.4084x larger

### nqueens ###
Min: 0.339744 -> 0.313506: 1.08x faster
Avg: 0.342630 -> 0.315380: 1.09x faster
Significant (t=73.41)
Stddev: 0.00218 -> 0.00146: 1.4931x smaller


If the principle gets accepted, we could experiment with further optimizations 
such as dedicated opcodes for addition-with-int-constant, 
subscripting-with-int-constant, etc.

--
files: smallints.patch
keywords: patch
messages: 118103
nosy: Aahz, aahz, mark.dickinson, pitrou, rhettinger, stutzbach
priority: normal
severity: normal
status: open
title: small int optimization
type: performance
versions: Python 3.2
Added file: http://bugs.python.org/file19148/smallints.patch

___
Python tracker 

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



[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor

STINNER Victor  added the comment:

r85302: _wrealpath() and _Py_wreadlink() support surrogates in the input path.

--

realpath_fs_encoding.patch: patch _wrealpath() to encode the resulting path 
with the filesystem encoding (with surrogateescape) instead of the locale 
encoding. This patch is incomplete: it doesn't fix the issue for non-Windows 
platforms without the realpath() function.

redecode_filename.patch (from issue #10039) + realpath_fs_encoding.patch fix 
this issue on my Linux (Debian Sid) box.

--
keywords: +patch
Added file: http://bugs.python.org/file19147/realpath_fs_encoding.patch

___
Python tracker 

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



[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor

STINNER Victor  added the comment:

This issue depends on issue #10039.

--
dependencies: +python é.py fails with UnicodeEncodeError if PYTHONFSENCODING is 
used

___
Python tracker 

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



[issue10043] UnboundLocalError with local variable set by setattr, caused by code run later

2010-10-07 Thread Eric Smith

Eric Smith  added the comment:

When python sees the assignment "name = None", it assumes that 'name' is a 
local variable. This happens before any code is executed. It then sees that 
you're printing 'name' before it is assigned to, which is an error. It does not 
take into account the dynamic creation of the module level variable.

--
nosy: +eric.smith
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue10043] UnboundLocalError with local variable set by setattr, caused by code run later

2010-10-07 Thread Steven Samuel Cole

New submission from Steven Samuel Cole :

inside a function, I create a local variable by using setattr with the current 
module as object, as in
  setattr(modules[__name__], 'name', 'value')

if I _later_ in the code set name to None, the attribute becomes unavailable 
even for code that is executed _before_ setting name to None.

please also see sample file.

--
components: Interpreter Core
files: show_weird_behavior.py
messages: 118099
nosy: ssc
priority: normal
severity: normal
status: open
title: UnboundLocalError with local variable set by setattr, caused by code run 
later
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file19146/show_weird_behavior.py

___
Python tracker 

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



[issue809163] Can't add files with spaces

2010-10-07 Thread Anders Sandvig

Changes by Anders Sandvig :


--
nosy: +asandvig

___
Python tracker 

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



[issue10038] Returntype of json.loads() on strings

2010-10-07 Thread Nik Tautenhahn

Nik Tautenhahn  added the comment:

Yep, the solution should not be "maybe it's str, maybe it's unicode" - I mean, 
if the decoder gives you a str if there are no fancy characters and unicode if 
it contains some, this might lead to some confusion... And yes, in my opinion, 
this is a bug, too.

--

___
Python tracker 

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



[issue10038] Returntype of json.loads() on strings

2010-10-07 Thread Nik Tautenhahn

Nik Tautenhahn  added the comment:

Well, then at least the documentation and the "What's changed" need to be 
updated. Furthermore, if such decisions are made, it would be at least nice to 
have some general "decode-hook" for json.JSONDecoder - the "object_hook" is 
only used for dict-objects - why is there no hook for strings or a general hook 
which is used on any objects?

--

___
Python tracker 

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



[issue10042] total_ordering stack overflow

2010-10-07 Thread Francesco Ricciardi

Francesco Ricciardi  added the comment:

Attached there is a solution of the problem, by implementing each comparison 
only with the class __xx__ and __eq__ operators.

Also in the file there is a complete test suite for it.

--
Added file: http://bugs.python.org/file19145/new_total_ordering.py

___
Python tracker 

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



[issue10042] total_ordering stack overflow

2010-10-07 Thread Francesco Ricciardi

New submission from Francesco Ricciardi :

Tested with version 3.2a2. Not tested on version 2.7.

The current implementation of functools.total_ordering generates a stack 
overflow because it implements the new comparison functions with inline 
operator, which the Python interpreter might reverse if "other" does not 
implement them. Reversing the comparison makes the interpreter call again the 
lambda function for comparison generating a stack overflow.

Run the attached test file for an example of this behavior.

--
components: Library (Lib)
files: test_total_ordering.py
messages: 118096
nosy: francescor
priority: normal
severity: normal
status: open
title: total_ordering stack overflow
type: crash
versions: Python 3.2
Added file: http://bugs.python.org/file19144/test_total_ordering.py

___
Python tracker 

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



[issue2571] cmd.py always uses raw_input, even when another stdin is specified

2010-10-07 Thread Éric Araujo

Éric Araujo  added the comment:

Can we reopen this as a feature request for 3.2?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue9003] urllib.request and http.client should allow certificate checking

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

A big warning is now present (*) in the urllib and httplib documentation pages. 
Also, once issue1589 is fixed, we can go forward and make 
{http.client,urllib.request} check hostname and cert if the user gives the 
location of a bunch of CA certs.

(*) see e.g. http://docs.python.org/dev/library/urllib.request.html

--
dependencies: +New SSL module doesn't seem to verify hostname against 
commonName in certificate
nosy: +Ryan.Tucker, ahasenack, db, devin, heikki, janssen, kiilerix, vila, zooko
stage:  -> needs patch
title: urllib about https behavior -> urllib.request and http.client should 
allow certificate checking
type:  -> feature request
versions: +Python 3.2, Python 3.3 -Python 3.1

___
Python tracker 

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-10-07 Thread Mads Kiilerich

Mads Kiilerich  added the comment:

> Indeed. But, strictly speaking, there are no tests for IPs, so it
> shouldn't be taken for granted that it works, even for commonName.
> The rationale is that there isn't really any point in using an IP rather
> a host name.

I don't know if there is a point or not, but some hosts are for some 
reason intended to be connected to using IP address and their 
certificates thus contains IP addresses. I think we should support that 
too, and I find it a bit confusing to only have partial support for 
subjectAltName.

> Well, that's additional logic to code. I'm not sure it's worth it,
> especially given that the function is called match_hostname in the first
> place.

"hostname" in Python usually refers to both IP addresses and DNS 
hostnames (just like in URLs), so I think it is a fair assumption that 
IP addresses also works in this hostname function.

Perhaps it should be noted that CertificateError only is raised by 
match_hostname so a paranoid programmer don't start catching it 
everywhere - and also that match_hostname won't raise SSLError.

--

___
Python tracker 

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



[issue8584] test_multiprocessing skips some tests

2010-10-07 Thread Brian Curtin

Brian Curtin  added the comment:

Fixed in r85299 (py3k), r85300 (release31-maint), and r85301 (release27-maint).

--
assignee: jnoller -> brian.curtin
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed
versions: +Python 2.7

___
Python tracker 

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



[issue9759] GzipFile object should raise ValueError on .read() after .close()

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Patch committed in r85291 (3.x), and backported to 3.1 (r85293) and 2.7 
(r85292). Thank you!

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

___
Python tracker 

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



[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu

New submission from kai zhu :

i'm working on an independent py2to3 utility which directly imports py2x 
modules, by reverse compiling ast trees 
(code.google.com/p/asciiporn/source/browse/stable.py)

while forward porting the python2x redis client, this issue came up.
i kno its bad to use strings in sockets, but it seems webapps use it exploiting 
the fact utf8 is becoming a defacto web 'binary' standard



$ python3.1 echo.py
connected  ('127.0.0.1', 
41115)

$ python3.1 client.py 
b'hello\r\n' recv()
b'hello\r\n' makefile(mode = "rb")
'hello\n' makefile(mode = "r")


## echo.py - echo server program
import socket
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
  serv.bind(('localhost', 12345))
  serv.listen(1)
  while True:
conn, addr = serv.accept()
print( 'connected', conn, addr )
while True:
  data = conn.recv(4096)
  if not data:
conn.close()
break
  conn.send(data)
finally:
  serv.close()



## client.py - client program
data = b'hello\r\n'
import socket
clie = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
  clie.connect(('localhost', 12345))

  clie.send(data)
  data = clie.recv(4096)
  print(repr(data), 'recv()')

  clie.send(data)
  file = clie.makefile('rb')
  data = file.readline()
  print(repr(data), 'makefile(mode = "rb")')

  clie.send(data)
  file = clie.makefile('r')
  data = file.readline()
  print(repr(data), 'makefile(mode = "r")') ## '\r' is silently dropped
finally:
  clie.close()

--
components: 2to3 (2.x to 3.0 conversion tool), IO, Library (Lib), Unicode
messages: 118095
nosy: kaizhu
priority: normal
severity: normal
status: open
title: socket.makefile(mode = 'r').readline() silently removes carriage return
type: behavior
versions: Python 3.1, Python 3.2

___
Python tracker 

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



[issue10040] GZipFile failure on large files

2010-10-07 Thread Robert Rohde

New submission from Robert Rohde :

I attempted to use GZipFile to process a 1.93 GB file that expands to 18.8 GB.

This consistently produces the same corrupted output file that has 
approximately, but not exactly, the right output file size.

I bypassed GZipFile by calling the 7-Zip executable to open the compressed 
file.  This works correctly and consistently.

I haven't tried to figure out how GZipFile works, but I assume that this 
failure is probably related to the very large size of the files I am working 
with.  I've used GZipFile before on much smaller files with no apparent 
problems.  I have no idea what precisely goes wrong, or how to fix it, but I 
felt it was important to note that GZipFile isn't working for at least some 
very large files.

--
components: Library (Lib)
messages: 118091
nosy: Robert.Rohde
priority: normal
severity: normal
status: open
title: GZipFile failure on large files
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue10038] Returntype of json.loads() on strings

2010-10-07 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr.  added the comment:

As I understand it, the decision to return str instead of unicode
values for the "simplejson" module was simply inherited by the
standard library.  As such, it still needs to be evaluated in the
context of the standard library, because of the incompatibility it
introduces.

I still maintain that it's a bug, and should be treated as such.

--

___
Python tracker 

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



[issue10039] python é.py fails with UnicodeEncodeErr or if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor

New submission from STINNER Victor :

If a program name contains a non-ascii character in its name and/or full path 
and PYTHONFSENCODING is set to an encoding different than the locale encoding, 
Python fails to open the program.

Example in the utf-8 locale:

$ PYTHONFSENCODING=ascii ./python é.py
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 0: 
ordinal not in range(128)

This issue is similar to #9992 and #10014.

Solutions: remove PYTHONFSENCODING environment variable or redecode the 
filename from the locale encoding to the filesystem encoding.

Attached patch implements the latter.

--

We may also redecode Py_GetProgramName().

--
components: Interpreter Core, Unicode
files: redecode_filename.patch
keywords: patch
messages: 118089
nosy: haypo
priority: normal
severity: normal
status: open
title: python é.py fails with UnicodeEncodeError if PYTHONFSENCODING is used
versions: Python 3.2
Added file: http://bugs.python.org/file19143/redecode_filename.patch

___
Python tracker 

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Here is a new patch with doc updates and the corrections mentioned above.

--
Added file: http://bugs.python.org/file19141/sslcheck2.patch

___
Python tracker 

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



[issue10028] test_concurrent_futures fails on Windows Server 2003

2010-10-07 Thread Brian Curtin

Brian Curtin  added the comment:

I'm getting error 6 aka ERROR_INVALID_HANDLE.

I'll try to figure out what's going on later this week if I can find time. I'll 
also run this on my Server 2008 machine to see how works.

--

___
Python tracker 

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



[issue2142] difflib.unified_diff(...) produces invalid patches

2010-10-07 Thread Trent Mick

Changes by Trent Mick :


--
assignee:  -> trentm

___
Python tracker 

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I don't know if there is a point or not, but some hosts are for some 
> reason intended to be connected to using IP address and their 
> certificates thus contains IP addresses. I think we should support that 
> too, and I find it a bit confusing to only have partial support for 
> subjectAltName.

Do you have examples? Otherwise it is difficult to implement.

--

___
Python tracker 

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



[issue2571] cmd.py always uses raw_input, even when another stdin is specified

2010-10-07 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Since 'we' can reopen any closed issue, I will try to answer what I think you 
might be asking.

I closed this because of Daniel's suggestion coupled with the Richard 
disclaiming further interest and neither Raghuram nor any new responder saying 
anything more.

The issue title is a misstatement arising from the OP not noticing how to 
change the behavior. Anyone reopening this (or opening a new issue) would need 
to change the title to reflect what he thinks should be done. I will not do 
that because the naive change proposed in the thread seems unnecessary, while 
further investigation suggests that it may be wrong or insufficient.

The original post refers to use_rawinput as a 'module global value'. It is not 
that but a cmd.Cmd class data attribute that can be changed either for the 
class or an instance. It is one of 9 that might be so changed.

Looking at the patch with #405952 shows that Cmd.__init__ had no parameters and 
Cmd.cmdloop always read input with raw_input(), now renamed just input() 
(making the attribute name a bit obsolete). The replacement then was something 
like

if self.use_rawinput:
try:
line = input(self.prompt)
except EOFError:
line = 'EOF'
else:
sys.stdout.write(self.prompt) # note sys.,
sys.stdout.flush()# not self. here
line = sys.stdin.readline()
if not len(line):
line = 'EOF'
else:
line = line[:-1] # chop \n

The reason for this patch, which *almost* replicates raw_input(), was that 
raw_input and/or readline swallowed an exception, whereas the replacement code 
does not. I wonder:
1. Does input() still do the same and should it?
2. Is there something about cmd processing that this is the only use of input() 
where this exception swallowing is a problem?
3. If so, why not always use the replacement? Speed?
4. I am sort of asking whether this was/is really the right hack.

Someone later added completekey as an initialization parameter (rather than as 
a date attribute) and the following code

if self.use_rawinput and self.completekey:
try:
import readline
self.old_completer = readline.get_completer()
readline.set_completer(self.complete)
readline.parse_and_bind(self.completekey+": complete")
except ImportError:

I know nothing about readline and why it (apparently) requires the use of 
input(), but the point here is that setting use_rawinput to False disables 
completekey. This should be documented but I did not see such.

At the same or later time, someone added stdin and stdout parameters and change 
'sys' to 'self' in the first snippet above. Given that these parameters appears 
useless when use_rawinput is True, why was use_rawinput not automatically set 
to false then? Blunder or subtle reason? Someone who proposes auto-resetting 
should try to find the name of the patch and/or commit author and ask.

It seems to me that all the process parameters should be handled uniformly. 
Make then all class attributes and let any be changed for instances as keyword 
attributes to __init__(). Given the conflict noted above, perhaps raise 
ValueError if someone makes contradictory changes.

So, Éric, if your question was academic, I would leave this closed.
If it was not, and you want to reopen, retitle, and assign it to yourself, go 
ahead.

--

___
Python tracker 

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



[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor

STINNER Victor  added the comment:

> The problem is that PySys_SetArgvEx() ...

Not only PySys_SetArgvEx(). There is another issue with RunMainFromImporter() 
which do: sys.path[0] = filename

--

___
Python tracker 

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



[issue9163] test_gdb fails

2010-10-07 Thread Tom Morris

Tom Morris  added the comment:

Sorry, I misread the 'version' field as the version the fix was committed for, 
not the version the bug was reported against.

The fix was reportedly fixed in r82648 and v2.7 is r82500.  If there's ever a 
2.7.1, I guess the fix will appear, but since the solution is to just ignore 
the test, that's easy to do manually. :-)

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-10-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Updated patch against current py3k.

--
Added file: http://bugs.python.org/file19142/unialloc6.patch

___
Python tracker 

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



[issue10014] sys.path[0] is incorrect if PYTHONFSENCODING is used

2010-10-07 Thread STINNER Victor

STINNER Victor  added the comment:

See also issue #10039.

--

___
Python tracker 

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