[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +loewis

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



[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Antoine Pitrou

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

Releasing the GIL when calling C library functions (e.g. opendir()) is not a 
requirement, it's just an optimization for slightly better multi-threading. 
Also, as shown in the backtrace, PyGILState_Ensure() is called which should 
only try to acquire the GIL if it isn't already held by the current thread; 
that is, it is designed to avoid the deadlock you are witnessing.

So, I would suggest the problem lies somewhere else. Does FUSE implicitly do a 
fork() of the current process? It's not obvious how the example shown here 
works.

--
nosy: +pitrou

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



[issue3599] test_pydoc after test_urllib2 causes exception in Popen.__del__

2010-01-20 Thread Yinon Ehrlich

Yinon Ehrlich yino...@users.sourceforge.net added the comment:

I saw this error in my scripts when using Python 2.5 on Ubuntu.
When imported trunk version instead of Python2.5 one, it disappeared.

So it's fixed in subprocess - def __del__

--
nosy: +Yinon

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



[issue5115] Extend subprocess.kill to be able to kill process groups

2010-01-20 Thread Thomas Guettler

Changes by Thomas Guettler guet...@thomas-guettler.de:


--
nosy: +guettli

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



[issue5879] multiprocessing - example pool of http servers fails on windows socket has no attribute fromfd

2010-01-20 Thread Jeong-Min Lee

Changes by Jeong-Min Lee false...@gmail.com:


--
nosy: +falsetru

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



[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Nikolaus Rath

Nikolaus Rath nikol...@rath.org added the comment:

In this simple example, FUSE does not fork and does not start any threads.

Note that PyGILState_Ensure() cannot do anything here. What happens is this:

 - call_hello.py calls FUSE in a new thread, releasing the GIL.
 - FUSE mounts the file system and waits for requests
 - Meanwhile, in the main thread, call_hello.py calls opendir(), but does not 
release the GIL
 - FUSE receives the opendir() system call and calls the appropriate callback 
function
 - If the callback function is implemented in C, everything works fine.
 - If the callback function is implemented in Python, the FUSE thread tries to 
acquire the GIL to call the (Python) opendir() handler. But it cannot do so, 
because the GIL is still held by the main thread (which is waiting for the 
opendir syscall to return) = deadlock.

--

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



[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Antoine Pitrou

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

Ah, thanks for the explanation. Yes indeed the patch looks ok for the
job. You should just be aware that similar problems may appear with
other system calls. I don't think we have ever considered that common C
calls such as opendir() could call back into Python code through
libraries such as FUSE.

By the way, it seems there are Python bindings for FUSE, in two
different flavours. You might want to look into them, and perhaps to
check whether they also experience this issue.

Le mercredi 20 janvier 2010 à 12:12 +, Nikolaus Rath a écrit :
 Nikolaus Rath nikol...@rath.org added the comment:
 
 In this simple example, FUSE does not fork and does not start any threads.
 
 Note that PyGILState_Ensure() cannot do anything here. What happens is this:
 
  - call_hello.py calls FUSE in a new thread, releasing the GIL.
  - FUSE mounts the file system and waits for requests
  - Meanwhile, in the main thread, call_hello.py calls opendir(), but does not 
 release the GIL
  - FUSE receives the opendir() system call and calls the appropriate callback 
 function
  - If the callback function is implemented in C, everything works fine.
  - If the callback function is implemented in Python, the FUSE thread tries 
 to acquire the GIL to call the (Python) opendir() handler. But it cannot do 
 so, because the GIL is still held by the main thread (which is waiting for 
 the opendir syscall to return) = deadlock.

--

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



[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Nikolaus Rath

Nikolaus Rath nikol...@rath.org added the comment:

I have used both of them in the past, but in the end I wrote my own bindings 
(currently only available as part of the http://code.google.com/p/s3ql source 
code, but I intend to factor it out at some point), 
since neither fuse.py (http://code.google.com/p/fusepy) nor python-fuse 
(fuse.sf.net) support the FUSE low level API.

That said, I am reasonably sure that in both of them are affected by this bug 
too. However, it may not show up in practive very often, because the high level 
FUSE API by default forks into a background process before mounting the file 
system.

--

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



[issue7710] Inconsistent Exception for int() conversion

2010-01-20 Thread Mark Dickinson

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


--
nosy: +mark.dickinson

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



[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Nikolaus Rath

Nikolaus Rath nikol...@rath.org added the comment:

On 01/20/2010 07:19 AM, Antoine Pitrou wrote:
 Ah, thanks for the explanation. Yes indeed the patch looks ok for the
 job. You should just be aware that similar problems may appear with
 other system calls. I don't think we have ever considered that common C
 calls such as opendir() could call back into Python code through
 libraries such as FUSE.

Well, now that I know what to look for, tracking down more of these 
problems should be significantly faster and easier. Are you generally 
going to accept similar patches for other unprotected syscalls?

Still, I'd be extremly grateful if someone could tell me the trick how 
to create a backtrace in such a deadlock situation... Or am I the only 
one for which a simple gdb -a does not work?

Best,

-Nikolaus

--
title: os.listdir hangs since opendir() and closedir() do not release GIL - 
os.listdir hangs since opendir() and closedir() do not release GIL

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



[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Antoine Pitrou

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

 Well, now that I know what to look for, tracking down more of these 
 problems should be significantly faster and easier. Are you generally 
 going to accept similar patches for other unprotected syscalls?

Until now the rule of thumb was to consider only time-consuming syscalls
(as I said, the primary goal is optimizing multi-threaded I/O). But I
guess we can accept such patches if they have no downsides. Martin, what
do you think?

 Still, I'd be extremly grateful if someone could tell me the trick how 
 to create a backtrace in such a deadlock situation... Or am I the only 
 one for which a simple gdb -a does not work?

Perhaps you can try to crash the process (using `kill -ABRT`) and then
load the core dump using gdb.

--

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



[issue7743] Additional potential string - float conversion issues.

2010-01-20 Thread Mark Dickinson

New submission from Mark Dickinson dicki...@gmail.com:

1. Another potential crash caused by Python/dtoa.c:  if the bigcomp 
functionality is disabled by replacing #define STRTOD_DIGLIM 40 with #define 
STRTOD_DIGLIM 4000, then the following string causes a crash:

 s = 
 '52544065335295526610966106035820281956125898496491389225652784975895604521825705971376587425143619361944324820599887000163386565751744735599222585294591201666866210283807209850662224417504752264995360631512007753855801075373057632157738752800840302596237050247910530538250008682272783660778181628040733653121492436408812668023478001208529190359254322340397575185248844788515410722958784640926528544043090115352513640884988017342469275006999104519620946430818767147966495485406577703972687838176778993472989561959470366389383963331466851379030183764964083197053338684769252973171365139701890736933147103189912528110505014483268752328506004517760913030437151571912928276140468769502257147431182910347804663250851413437345649151934269945872064326973371182115272789687312946393533547747886024677951678751174816604738791256853675690543663283782215866825e-1180'
[38199 refs]
 float(s)
cmp called with a-x[a-wds-1] == 0

I haven't yet found any examples that cause this crash without bigcomp enabled.

The crash is caused by a combination of two problems. (1) there's a buggy check 
for the smallest denormal in the if ((aadj = ratio(delta, bs)) = 2.) { block 
in _Py_dg_strtod:  the check ignores the possibility that bc.scale is nonzero.  
(2) The Bigint functions don't deal well with zero inputs:  in particular, d2b 
gives strange results, and left shifting a zero Bigint can give a 
non-normalized result.

2. The check:

if (!(word1(rv)  LSB))
break;

in _Py_dg_strtod again doesn't take into account the possibility that bc-scale 
is nonzero.  It's supposed to be used in exact halfway cases to determine 
whether the current rv is already 'even' for the purposes of 
round-half-to-even.  But for subnormal scaled rv, this check will (wrongly) 
always succeed, potentially giving an incorrectly rounded result.

However, it seems to be difficult to trigger this bug:  the input must be a 
subnormal exact halfway case, which implies it must have many hundred digits.  
On the first pass through the strtod correction loop, the approximation is 
likely to be out by a few ulps, so we almost never hit the (i == 0) branch.  
The adjustment for the second pass then typically gives *exactly* the right 
result, as a consequence of the floating-point addition using 
round-half-to-even.

--
assignee: mark.dickinson
components: Interpreter Core
messages: 98080
nosy: mark.dickinson
priority: normal
severity: normal
stage: needs patch
status: open
title: Additional potential string - float conversion issues.
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

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



[issue7743] Additional potential string - float conversion issues.

2010-01-20 Thread Eric Smith

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


--
nosy: +eric.smith

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



[issue7743] Additional potential string - float conversion issues.

2010-01-20 Thread Mark Dickinson

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

Okay, it's not that difficult to trigger (2).  With the bigcomp functionality 
disabled as above:

AssertionError: Incorrectly rounded str-float conversion for 
1165128749405941956386179070925698815190347932293852285691651915418908465646697717148969160848839879204733212681002968576362009260653407696828633492053633492476376606717832099079492736830403979799841078064618226933327128283976179460362395816329765851006335202607707610607254039041231443845716120737327547745882119444064655725910220819738284489273386025562878518317454193974330124918848694544624405368950474994365519746497319171700993877628710204035829941934397619334121668214840158836316225393142037990344979821300387417417279074295756733024613803865965011874820062575277098421793364883816728187984502293391235278588833681591202045229462491699354638895656152216187535257259042082360747878839946016222830869374205287663441403533948204085390898399055004119873046875e-1075:
 expected 0x0.0d67b36890cfcp-1022, got 0x0.0d67b36890cfbp-1022

--

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



[issue7736] os.listdir hangs since opendir() and closedir() do not release GIL

2010-01-20 Thread Marcin Bachry

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

 Still, I'd be extremly grateful if someone could tell me the trick how 
to create a backtrace in such a deadlock situation

Sorry, I should have mentioned that. In order to get backtrace you let the 
process freeze, attach gdb to it (it will freeze too), then go to 
/sys/fs/fuse/connections/ and find your fuse connection (it's most likely the 
one with non-zero value in waiting file). Then do echo 1  abort and go 
back to gdb.

--

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



[issue2015] Possible optimisations in kwargs handling

2010-01-20 Thread Brian Curtin

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

This was handled in r65241 as a result of #1819.

--
nosy: +brian.curtin
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
superseder:  - Speed hack for function calls with named parameters

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



[issue1479611] speed up function calls

2010-01-20 Thread Ezio Melotti

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


--
keywords: +needs review
stage:  - patch review
versions: +Python 2.7 -Python 2.6

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



[issue7744] Allow site.addsitedir insert to beginning of sys.path

2010-01-20 Thread Chris Lasher

New submission from Chris Lasher chris.las...@gmail.com:

Would it be possible to add an extra option to site.addsitedir so that it 
left-appends (inserts at the beginning of the list rather than the end of the 
list) to sys.path the new path?

The use case for this is that sometimes the user has local versions of packages 
and modules they would prefer to use over versions installed system-wide. Since 
Python searches for packages and modules in the order given by sys.path, 
inserting the new path(s) at the beginning of sys.path. This leads to hack-ish 
work-arounds, such as the one given by 
http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

If there was an option to left-append with site.addsitedir, it would really 
help in cases such as these.

Note that I'm not certain at the moment how best to add additional paths that 
are found in .pth files, i.e., whether to insert them at the beginning as well, 
or insert them between the initial path and the original paths (the paths that 
existed before site.addsitedir is called).

--
components: Library (Lib)
messages: 98084
nosy: gotgenes
severity: normal
status: open
title: Allow site.addsitedir insert to beginning of sys.path
type: feature request

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



[issue7744] Allow site.addsitedir insert to beginning of sys.path

2010-01-20 Thread Chris Lasher

Chris Lasher chris.las...@gmail.com added the comment:

One correction: by beginning of sys.path, what I really mean is, the portion 
of sys.path after the initial ''. I forgot that '', the empty path, should 
always be at the start of sys.path to ensure that packages and modules in the 
current working directory are given top priority. Thus, I would like to see 
insertions between sys.path[0] and sys.path[1].

Sorry for the confusion.

--

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



[issue5115] Extend subprocess.kill to be able to kill process groups

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 I suspect that on Windows, TerminateJobObject won't work 
 with a handle returned by CreateProcess.

TerminateJobObject works with CreateJobObject and AssignProcessToJobObject. The 
following code (from your patch) should call AssignProcessToJobObject (and 
CreateJobObject if there is no job yet):

+if not mswindows:
+os.setpgid(0, 0)

--
nosy: +haypo

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



[issue7745] Remove isatty check when setting sys.std[in|out|err] encoding to that of locale

2010-01-20 Thread Brian Curtin

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


--
keywords: +needs review
priority:  - normal
stage:  - test needed
type:  - behavior

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



[issue7739] time.strftime may hung while trying to open /etc/localtime but does not release GIL

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 It appears that the stall happens due to time.strftime call, which internally 
 opens 
 a file ('/etc/localtime')

In the GNU libc, strftime() calls tzset() and tzset() uses a lock to be thread 
safe. Yes, releasing the GIL before calling strftime() would speed up your use 
case.

--
nosy: +haypo

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



[issue7720] Errors in tests and C implementation of raw FileIO

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

IOTest.test_destructor() is already fixed in Python trunk (future 2.7) by 
r73394 (Issue #6215: backport the 3.1 io lib).

I don't think that it would be possible to backport the 3.1 io lib in Python 
2.6. Would it possible to backport only the io tests?

--
nosy: +haypo

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



[issue7745] Remove isatty check when setting sys.std[in|out|err] encoding to that of locale

2010-01-20 Thread Antoine Pitrou

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

As discussed on python-dev, this patch should probably be rejected.

--
nosy: +pitrou

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



[issue7708] test_xmlrpc fails with non-ascii path

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

SimpleXMLRPCRequestHandler.do_POST() writes the traceback in the HTTP header 
X-traceback. But an HTTP header value is ASCII only, whereas a traceback can 
contain any character (eg. an non-ASCII character from a directory name for 
this issue).

A simple fix would be to use the ASCII charset with the backslashreplace error 
handler. Attached patch uses:

   trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII')

Is there an easier method to escape non-ASCII characters without double 
conversion (unicode-bytes and bytes-unicode)?

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file15958/xmlrpc_server_ascii_traceback.patch

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



[issue7739] time.strftime may hung while trying to open /etc/localtime but does not release GIL

2010-01-20 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file15954/unnamed

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



[issue7739] time.strftime may hung while trying to open /etc/localtime but does not release GIL

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Here you have a patch releasing the GIL for the call to strftime().

--
keywords: +patch
Added file: http://bugs.python.org/file15959/time_strftime_gil.patch

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



[issue7739] time.strftime may hung while trying to open /etc/localtime but does not release GIL

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

time_tzset() might also release the GIL, but:
 - i hope that multithreaded programs don't call regulary tzset() in different 
threads
 - time_tzset() calls tzset() and inittimezone()
 - inittimezone() modify the time module attributes and may call tzset() 
(depending on the OS / C library). it's also called from inittime()

So I prefer to leave it unchanged :-)

--

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



[issue4722] _winreg.QueryValue fault while reading mangled registry values

2010-01-20 Thread Brian Curtin

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


Removed file: http://bugs.python.org/file15265/issue4722_20091104_v1.patch

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



[issue4722] _winreg.QueryValue fault while reading mangled registry values

2010-01-20 Thread Brian Curtin

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

On Windows 7, I see the issue as both a regular user and one with admin 
privileges. The patch (updated to fix tab/space difference) seems to do the 
trick. 
Gabriel, which OS are you on that this works differently based on the user 
privileges?

I'm still not sure how to test this...not sure how to modify the binary data 
and leave it blank via code.

--
Added file: http://bugs.python.org/file15960/issue4722.diff

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



[issue7727] xmlrpc library returns string which contain null ( \x00 )

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Marshaller.dump_string() encodes a byte string in string.../string using 
the escape() function. A byte string can be encoded in base64 using 
base64.../base64. It's described in the XML-RPC specification, but I don't 
know if all XML-RPC implementations do understand this type.
http://www.xmlrpc.com/spec

Should we change the default type to base64, or only fallback to base64 if the 
byte string cannot be encoded in XML. Test if a byte string can be encoded in 
XML can be slow, and set default type to base64 may cause compatibility issues 
:-/

--
nosy: +haypo

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



[issue7727] xmlrpc library returns string which contain null ( \x00 )

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Here is an example of patch using the following test:

   all(32 = ord(byte) = 127 for byte in value)

I don't know how much slower is the patch, but at least it doesn't raise an 
ExpatError: not well-formed (invalid token): 

--
keywords: +patch
Added file: http://bugs.python.org/file15961/xmlrpc_byte_string.patch

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



[issue7727] xmlrpc library returns string which contain null ( \x00 )

2010-01-20 Thread Steven Hartland

Steven Hartland steven.hartl...@multiplay.co.uk added the comment:

One thing that springs to mind is how valid is that when applied to utf8 data?

--

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



[issue7668] test_httpservers fails with non-ascii path

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

CGIHTTPServerTestCase creates .py files with sys.executable in a shebang:
-
cgi_file1 = \
#!%s
...

with open(self.file1_path, 'w') as file1:
file1.write(cgi_file1 % sys.executable)
-
The shebang have to be the first line, and the encoding cookie (#coding:...) 
have to be written before any non-ASCII character. Since the shebang contains 
non-ASCII character, the cookie have to be written before... which is 
impossible.

Whereas issue #7708 contains the tested modules, this issue is specific to the 
tests themself.

Possible workaround: create a symbolic link to an ASCII directory (eg. 
/tmp/python) and use the link in the shebang.

--
nosy: +haypo

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



[issue7667] test_doctest fails with non-ascii path

2010-01-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

There are 2 different issues:
 * doctest.DocTestRunner.report_failure() raise an unicode error if the source 
line type is unicode: _failure_header() should convert the line to bytes using 
ASCII with backslashreplace error handler (as sys.stderr)
 * traceback.print_tb() raises an unicode error if the source line type is 
unicode: same solution (ASCII+bashslashreplace)

See also #Issue7708.

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file15962/test_doctest.patch

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



[issue7746] Nit: Extra comma in itertools doc

2010-01-20 Thread Justin Lebar

New submission from Justin Lebar star...@gmail.com:

At http://docs.python.org/3.1/library/itertools.html,

For instance, SML provides a tabulation tool: tabulate(f) which produces a 
sequence f(0), f(1),  But, this effect can be achieved in Python by 
combining map() and count() to form map(f, count()).

The second sentence should be But this effect..., not But, this effect.

No issue is too small, right?  :)

--
assignee: georg.brandl
components: Documentation
messages: 98100
nosy: Justin.Lebar, georg.brandl
severity: normal
status: open
title: Nit: Extra comma in itertools doc
versions: Python 3.1

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



[issue7747] Function variable wrongly reported unassigned

2010-01-20 Thread Adrian May

New submission from Adrian May adrian.alexander@gmail.com:

Hi folks,

The attached program says:

$ ./bug.py
a
None
b
Traceback (most recent call last):
  File ./bug.py, line 49, in module
print number(s)
  File ./bug.py, line 34, in foo
while eat != None:
UnboundLocalError: local variable 'eat' referenced before assignment

but I reckon it is assigned. (I haven't tried it on a newer python because the 
junk I want to use with python says it only works with 2.5.2.) 

Cheers, Adrian.

--
components: Interpreter Core
files: bug.py
messages: 98101
nosy: adrianmay
severity: normal
status: open
title: Function variable wrongly reported unassigned
type: compile error
versions: Python 2.5
Added file: http://bugs.python.org/file15963/bug.py

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



[issue7747] Function variable wrongly reported unassigned

2010-01-20 Thread Ezio Melotti

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

This is not a bug, see 
http://docs.python.org/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value

--
nosy: +ezio.melotti
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
type: compile error - behavior

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