[issue7747] Function variable wrongly reported unassigned

2010-01-20 Thread Ezio Melotti
Ezio Melotti 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

[issue7747] Function variable wrongly reported unassigned

2010-01-20 Thread Adrian May
New submission from Adrian May : Hi folks, The attached program says: $ ./bug.py a None b Traceback (most recent call last): File "./bug.py", line 49, in print number(s) File "./bug.py", line 34, in foo while eat != None: UnboundLocalError: local variable 'eat' referenced before as

[issue7746] Nit: Extra comma in itertools doc

2010-01-20 Thread Justin Lebar
New submission from Justin Lebar : 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())." Th

[issue7667] test_doctest fails with non-ascii path

2010-01-20 Thread STINNER Victor
STINNER Victor 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.p

[issue7668] test_httpservers fails with non-ascii path

2010-01-20 Thread STINNER Victor
STINNER Victor 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 cook

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

2010-01-20 Thread Steven Hartland
Steven Hartland added the comment: One thing that springs to mind is how valid is that when applied to utf8 data? -- ___ Python tracker ___ __

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

2010-01-20 Thread STINNER Victor
STINNER Victor 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

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

2010-01-20 Thread STINNER Victor
STINNER Victor added the comment: Marshaller.dump_string() encodes a byte string in ... using the escape() function. A byte string can be encoded in base64 using It's described in the XML-RPC specification, but I don't know if all XML-RPC implementations do understand this type. http://w

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

2010-01-20 Thread Brian Curtin
Brian Curtin 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 sur

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

2010-01-20 Thread Brian Curtin
Changes by Brian Curtin : Removed file: http://bugs.python.org/file15265/issue4722_20091104_v1.patch ___ Python tracker ___ ___ Python-bugs-lis

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

2010-01-20 Thread STINNER Victor
STINNER Victor 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() (depe

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

2010-01-20 Thread STINNER Victor
STINNER Victor 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

[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 : Removed file: http://bugs.python.org/file15954/unnamed ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue7708] test_xmlrpc fails with non-ascii path

2010-01-20 Thread STINNER Victor
STINNER Victor 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

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

2010-01-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: As discussed on python-dev, this patch should probably be rejected. -- nosy: +pitrou ___ Python tracker ___

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

2010-01-20 Thread STINNER Victor
STINNER Victor 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? --

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

2010-01-20 Thread STINNER Victor
STINNER Victor 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 sp

[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 : -- keywords: +needs review priority: -> normal stage: -> test needed type: -> behavior ___ Python tracker ___

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

2010-01-20 Thread STINNER Victor
STINNER Victor 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 C

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

2010-01-20 Thread Dave Malcolm
New submission from Dave Malcolm : Currently sys.std[in|out|err] are set to the locale encoding but only if they are directly connected to a tty (and PYTHONIOENCODING is not set in the environment to override things). The conditionality on "isatty" leads to lots of unexpected changes when scri

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

2010-01-20 Thread Chris Lasher
Chris Lasher 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 a

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

2010-01-20 Thread Chris Lasher
New submission from Chris Lasher : 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 pack

[issue1479611] speed up function calls

2010-01-20 Thread Ezio Melotti
Changes by Ezio Melotti : -- keywords: +needs review stage: -> patch review versions: +Python 2.7 -Python 2.6 ___ Python tracker ___ __

[issue2015] Possible optimisations in kwargs handling

2010-01-20 Thread Brian Curtin
Brian Curtin 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 ___

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

2010-01-20 Thread Marcin Bachry
Marcin Bachry 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 g

[issue7743] Additional potential string -> float conversion issues.

2010-01-20 Thread Mark Dickinson
Mark Dickinson 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 1165128749405941956386179070925698815190347932293852285691651915418908465646697717148969160848839879

[issue7743] Additional potential string -> float conversion issues.

2010-01-20 Thread Eric Smith
Changes by Eric Smith : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue7743] Additional potential string -> float conversion issues.

2010-01-20 Thread Mark Dickinson
New submission from Mark Dickinson : 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 = >>> '52544065335295526610966106035820

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

2010-01-20 Thread Antoine Pitrou
Antoine Pitrou 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 ti

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

2010-01-20 Thread Nikolaus Rath
Nikolaus Rath 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 >

[issue7710] Inconsistent Exception for int() conversion

2010-01-20 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

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

2010-01-20 Thread Nikolaus Rath
Nikolaus Rath 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/fusep

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

2010-01-20 Thread Antoine Pitrou
Antoine Pitrou 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

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

2010-01-20 Thread Nikolaus Rath
Nikolaus Rath 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

[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 : -- nosy: +falsetru ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

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

2010-01-20 Thread Thomas Guettler
Changes by Thomas Guettler : -- nosy: +guettli ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

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

2010-01-20 Thread Yinon Ehrlich
Yinon Ehrlich 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

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

2010-01-20 Thread Antoine Pitrou
Antoine Pitrou 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

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

2010-01-20 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +loewis ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.