[ python-Bugs-1313496 ] bisect C replacement doesn't accept named args
Bugs item #1313496, was opened at 2005-10-05 00:27 Message generated for change (Settings changed) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313496&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Drew Perttula (drewp) >Assigned to: Raymond Hettinger (rhettinger) Summary: bisect C replacement doesn't accept named args Initial Comment: Code like "bisect.bisect(a,x,lo=y)" works in 2.3 but not in 2.4 due to the new _bisect module not accepting named arguments. _bisect (and all of the other C modules, for that matter) should accept named arguments to their functions. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313496&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1313496 ] bisect C replacement doesn't accept named args
Bugs item #1313496, was opened at 2005-10-05 00:27 Message generated for change (Settings changed) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313496&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Drew Perttula (drewp) Assigned to: Raymond Hettinger (rhettinger) Summary: bisect C replacement doesn't accept named args Initial Comment: Code like "bisect.bisect(a,x,lo=y)" works in 2.3 but not in 2.4 due to the new _bisect module not accepting named arguments. _bisect (and all of the other C modules, for that matter) should accept named arguments to their functions. -- >Comment By: Raymond Hettinger (rhettinger) Date: 2005-10-05 06:49 Message: Logged In: YES user_id=80475 Fixed. See Modules/_bisectmodule.c 1.3 and -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313496&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1313496 ] bisect C replacement doesn't accept named args
Bugs item #1313496, was opened at 2005-10-05 00:27 Message generated for change (Comment added) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313496&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Closed Resolution: Fixed Priority: 5 Submitted By: Drew Perttula (drewp) Assigned to: Raymond Hettinger (rhettinger) Summary: bisect C replacement doesn't accept named args Initial Comment: Code like "bisect.bisect(a,x,lo=y)" works in 2.3 but not in 2.4 due to the new _bisect module not accepting named arguments. _bisect (and all of the other C modules, for that matter) should accept named arguments to their functions. -- >Comment By: Raymond Hettinger (rhettinger) Date: 2005-10-05 06:51 Message: Logged In: YES user_id=80475 Fixed. See Modules/_bisectmodule.c 1.3 and 1.2.4.1. -- Comment By: Raymond Hettinger (rhettinger) Date: 2005-10-05 06:49 Message: Logged In: YES user_id=80475 Fixed. See Modules/_bisectmodule.c 1.3 and -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313496&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1313974 ] Compile fails for configure "--without-threads"
Bugs item #1313974, was opened at 2005-10-05 15:27 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313974&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Build Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: seidl (ulrichseidl) Assigned to: Nobody/Anonymous (nobody) Summary: Compile fails for configure "--without-threads" Initial Comment: When using the configure option "--without-threads", a subsequent make fails with: libpython2.4.a(pystate.o): In function `PyThreadState_New': Python/pystate.c:191: undefined reference to `_PyGILState_NoteThreadState' This is evidently caused by not compiling the function when "#ifdef WITH_THREAD" is not true. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313974&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1313974 ] Compile fails for configure "--without-threads"
Bugs item #1313974, was opened at 2005-10-05 15:27 Message generated for change (Comment added) made by ulrichseidl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313974&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Build Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: seidl (ulrichseidl) Assigned to: Nobody/Anonymous (nobody) Summary: Compile fails for configure "--without-threads" Initial Comment: When using the configure option "--without-threads", a subsequent make fails with: libpython2.4.a(pystate.o): In function `PyThreadState_New': Python/pystate.c:191: undefined reference to `_PyGILState_NoteThreadState' This is evidently caused by not compiling the function when "#ifdef WITH_THREAD" is not true. -- >Comment By: seidl (ulrichseidl) Date: 2005-10-05 15:30 Message: Logged In: YES user_id=1356859 This has been introduced with Python 2.4.2. (2.4.1 works fine). -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313974&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1313974 ] Compile fails for configure "--without-threads"
Bugs item #1313974, was opened at 2005-10-06 00:27 Message generated for change (Comment added) made by perky You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313974&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Build Group: Python 2.4 >Status: Closed >Resolution: Duplicate Priority: 5 Submitted By: seidl (ulrichseidl) Assigned to: Nobody/Anonymous (nobody) Summary: Compile fails for configure "--without-threads" Initial Comment: When using the configure option "--without-threads", a subsequent make fails with: libpython2.4.a(pystate.o): In function `PyThreadState_New': Python/pystate.c:191: undefined reference to `_PyGILState_NoteThreadState' This is evidently caused by not compiling the function when "#ifdef WITH_THREAD" is not true. -- >Comment By: Hye-Shik Chang (perky) Date: 2005-10-06 00:36 Message: Logged In: YES user_id=55188 Duplicate with SF #1307978 and it's fixed in CVS already. -- Comment By: seidl (ulrichseidl) Date: 2005-10-06 00:30 Message: Logged In: YES user_id=1356859 This has been introduced with Python 2.4.2. (2.4.1 works fine). -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1313974&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1314107 ] Issue in unicode args in logging
Bugs item #1314107, was opened at 2005-10-05 11:11 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314107&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Unicode Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Wai Yip Tung (tungwaiyip) Assigned to: M.-A. Lemburg (lemburg) Summary: Issue in unicode args in logging Initial Comment: logging has an issue in handling unicode object arguments. >>> import logging >>> >>> class Obj: ... def __init__(self,name): ... self.name = name ... def __str__(self): ... return self.name ... >>> # a non-ascii string ... >>> obj = Obj(u'\u00f6') >>> >>> # this will cause error ... >>> print '%s' % obj Traceback (most recent call last): File "", line 1, in ? UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128) >>> >>> # this will promote to unicode (and the console also happen to be able to display it) ... >>> print u'%s' % obj ö >>> >>> # this works fine ... # (other than logging makes its own decision to encode in utf8) ... >>> logging.error(u'%s' % obj) ERROR:root:├╢ >>> >>> # THIS IS AN UNEXPECTED PROBLEM!!! ... >>> logging.error(u'%s', obj) Traceback (most recent call last): File "C:\Python24\lib\logging\__init__.py", line 706, in emit msg = self.format(record) File "C:\Python24\lib\logging\__init__.py", line 592, in format return fmt.format(record) File "C:\Python24\lib\logging\__init__.py", line 382, in format record.message = record.getMessage() File "C:\Python24\lib\logging\__init__.py", line 253, in getMessage msg = msg % self.args UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128) >>> >>> # workaround the str() conversion in getMessage() ... >>> logging.error(u'%s-\u00f6', obj) ERROR:root:├╢-├╢ The issue seems to be in LogRecord.getMessage(). It attempts to convert msg to byte string: msg = str(self.msg) I am not sure why ti want to do the conversion. The last example workaround this by making sure msg is not convertible to byte string. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314107&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1193099 ] Embedded python thread crashes
Bugs item #1193099, was opened at 2005-04-30 12:03 Message generated for change (Comment added) made by ugodiggi You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1193099&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: ugodiggi (ugodiggi) Assigned to: Nobody/Anonymous (nobody) Summary: Embedded python thread crashes Initial Comment: The following code crashes about 1/3 of the times. My platform is Python 2.4.1 on WXP (I tried the release version from the msi and the debug version built by me). I can reproduce the same behavior on another wxp system, under python 2.4. The crash happens (in the python thread) while the main thread is in Py_Finalize. I traced the crash to _Py_ForgetReference(op) in object.c at line 1847, where I have op->_ob_prev == NULL. The open file seems to be the issue, since if I remove all the references to the file I cannot get the program to crash. Cheers and ciao Ugo // TestPyThreads.cpp // #include // Sleep #include "Python.h" int main() { PyEval_InitThreads(); Py_Initialize(); PyGILState_STATE main_restore_state = PyGILState_UNLOCKED; PyGILState_Release(main_restore_state); // start the thread { PyGILState_STATE state = PyGILState_Ensure(); int trash = PyRun_SimpleString( "import thread\n" "import time\n" "def foo():\n" " f = open('pippo.out', 'w', 0)\n" " i = 0;\n" " while 1:\n" "f.write('%d\n'%i)\n" "time.sleep(0.01)\n" "i += 1\n" "t = thread.start_new_thread(foo, ())\n" ); PyGILState_Release(state); } // wait 300 ms Sleep(300); PyGILState_Ensure(); Py_Finalize(); return 0; } -- >Comment By: ugodiggi (ugodiggi) Date: 2005-10-05 11:39 Message: Logged In: YES user_id=1269908 I would guess that the problem is going to be windows specific? I tested similar problem on both the debug and release build, and I did try to get some comment on comp.lang.python i.e. http://mail.python.org/pipermail/python-list/2005- April/278404.html my comment on the debugging was: > The crash happens while the main thread is in Py_Finalize. > I traced the crash to _Py_ForgetReference(op) in object.c at line 1847, > where I have op->_ob_prev == NULL. I did not look at the python code long enough to follow it. I will try to reproduce tonight and send out the stack - for whatever reason I'm not finding it any longer. -- Comment By: Neal Norwitz (nnorwitz) Date: 2005-10-03 22:37 Message: Logged In: YES user_id=33168 I can't reproduce on gentoo linux (amd64) with a debug build. I played with different values for sleep. BTW, it would be better if you attached the code as a file, since formatting is lost. Can you try to debug this problem? Can you attach info from the debugger? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1193099&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1314182 ] crash in longobject (invalid memory access)
Bugs item #1314182, was opened at 2005-10-05 15:03 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314182&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: None Status: Open Resolution: None Priority: 5 Submitted By: Jon Nelson (jnelson) Assigned to: Nobody/Anonymous (nobody) Summary: crash in longobject (invalid memory access) Initial Comment: While debugging a memory consumption problem, I disable pymalloc and found a crasher in longobject.c, line 2518 (Python 2.4.1). The code currently reads: Py_XDECREF(a); Py_XDECREF(b); Py_XDECREF(c); Py_XDECREF(temp); if (b->ob_size > FIVEARY_CUTOFF) { for (i = 0; i < 32; ++i) Py_XDECREF(table[i]); } return (PyObject *)z; It *should* read: Py_XDECREF(a); Py_XDECREF(c); Py_XDECREF(temp); if (b->ob_size > FIVEARY_CUTOFF) { for (i = 0; i < 32; ++i) Py_XDECREF(table[i]); } Py_XDECREF(b); return (PyObject *)z; because without the change you clearly access "b" *after* freeing it. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314182&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1314107 ] Issue in unicode args in logging
Bugs item #1314107, was opened at 2005-10-05 20:11 Message generated for change (Comment added) made by lemburg You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314107&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Unicode Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Wai Yip Tung (tungwaiyip) >Assigned to: Nobody/Anonymous (nobody) Summary: Issue in unicode args in logging Initial Comment: logging has an issue in handling unicode object arguments. >>> import logging >>> >>> class Obj: ... def __init__(self,name): ... self.name = name ... def __str__(self): ... return self.name ... >>> # a non-ascii string ... >>> obj = Obj(u'\u00f6') >>> >>> # this will cause error ... >>> print '%s' % obj Traceback (most recent call last): File "", line 1, in ? UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128) >>> >>> # this will promote to unicode (and the console also happen to be able to display it) ... >>> print u'%s' % obj ö >>> >>> # this works fine ... # (other than logging makes its own decision to encode in utf8) ... >>> logging.error(u'%s' % obj) ERROR:root:├╢ >>> >>> # THIS IS AN UNEXPECTED PROBLEM!!! ... >>> logging.error(u'%s', obj) Traceback (most recent call last): File "C:\Python24\lib\logging\__init__.py", line 706, in emit msg = self.format(record) File "C:\Python24\lib\logging\__init__.py", line 592, in format return fmt.format(record) File "C:\Python24\lib\logging\__init__.py", line 382, in format record.message = record.getMessage() File "C:\Python24\lib\logging\__init__.py", line 253, in getMessage msg = msg % self.args UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128) >>> >>> # workaround the str() conversion in getMessage() ... >>> logging.error(u'%s-\u00f6', obj) ERROR:root:├╢-├╢ The issue seems to be in LogRecord.getMessage(). It attempts to convert msg to byte string: msg = str(self.msg) I am not sure why ti want to do the conversion. The last example workaround this by making sure msg is not convertible to byte string. -- >Comment By: M.-A. Lemburg (lemburg) Date: 2005-10-05 22:47 Message: Logged In: YES user_id=38388 Unassinging the bug. I don't know anything about the logging module. Hint: perhaps the logging module should grow an .encoding attribute which then allows converting Unicode to some encoding used in the log file ?! -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314107&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1314182 ] crash in longobject (invalid memory access)
Bugs item #1314182, was opened at 2005-10-05 16:03 Message generated for change (Comment added) made by tim_one You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314182&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: None >Status: Closed >Resolution: Duplicate Priority: 5 Submitted By: Jon Nelson (jnelson) Assigned to: Nobody/Anonymous (nobody) Summary: crash in longobject (invalid memory access) Initial Comment: While debugging a memory consumption problem, I disable pymalloc and found a crasher in longobject.c, line 2518 (Python 2.4.1). The code currently reads: Py_XDECREF(a); Py_XDECREF(b); Py_XDECREF(c); Py_XDECREF(temp); if (b->ob_size > FIVEARY_CUTOFF) { for (i = 0; i < 32; ++i) Py_XDECREF(table[i]); } return (PyObject *)z; It *should* read: Py_XDECREF(a); Py_XDECREF(c); Py_XDECREF(temp); if (b->ob_size > FIVEARY_CUTOFF) { for (i = 0; i < 32; ++i) Py_XDECREF(table[i]); } Py_XDECREF(b); return (PyObject *)z; because without the change you clearly access "b" *after* freeing it. -- >Comment By: Tim Peters (tim_one) Date: 2005-10-05 16:54 Message: Logged In: YES user_id=31435 This is a duplicate of bug 1238681 (& already fixed). -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314182&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1314107 ] Issue in unicode args in logging
Bugs item #1314107, was opened at 2005-10-05 11:11 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314107&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Unicode Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Wai Yip Tung (tungwaiyip) >Assigned to: Vinay Sajip (vsajip) Summary: Issue in unicode args in logging Initial Comment: logging has an issue in handling unicode object arguments. >>> import logging >>> >>> class Obj: ... def __init__(self,name): ... self.name = name ... def __str__(self): ... return self.name ... >>> # a non-ascii string ... >>> obj = Obj(u'\u00f6') >>> >>> # this will cause error ... >>> print '%s' % obj Traceback (most recent call last): File "", line 1, in ? UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128) >>> >>> # this will promote to unicode (and the console also happen to be able to display it) ... >>> print u'%s' % obj ö >>> >>> # this works fine ... # (other than logging makes its own decision to encode in utf8) ... >>> logging.error(u'%s' % obj) ERROR:root:├╢ >>> >>> # THIS IS AN UNEXPECTED PROBLEM!!! ... >>> logging.error(u'%s', obj) Traceback (most recent call last): File "C:\Python24\lib\logging\__init__.py", line 706, in emit msg = self.format(record) File "C:\Python24\lib\logging\__init__.py", line 592, in format return fmt.format(record) File "C:\Python24\lib\logging\__init__.py", line 382, in format record.message = record.getMessage() File "C:\Python24\lib\logging\__init__.py", line 253, in getMessage msg = msg % self.args UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128) >>> >>> # workaround the str() conversion in getMessage() ... >>> logging.error(u'%s-\u00f6', obj) ERROR:root:├╢-├╢ The issue seems to be in LogRecord.getMessage(). It attempts to convert msg to byte string: msg = str(self.msg) I am not sure why ti want to do the conversion. The last example workaround this by making sure msg is not convertible to byte string. -- >Comment By: Neal Norwitz (nnorwitz) Date: 2005-10-05 21:00 Message: Logged In: YES user_id=33168 Vinay, any suggestions? -- Comment By: M.-A. Lemburg (lemburg) Date: 2005-10-05 13:47 Message: Logged In: YES user_id=38388 Unassinging the bug. I don't know anything about the logging module. Hint: perhaps the logging module should grow an .encoding attribute which then allows converting Unicode to some encoding used in the log file ?! -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314107&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1314519 ] logging run into deadlock in some error handling situation
Bugs item #1314519, was opened at 2005-10-05 22:56 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314519&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Wai Yip Tung (tungwaiyip) Assigned to: Nobody/Anonymous (nobody) Summary: logging run into deadlock in some error handling situation Initial Comment: I've a daemon that pipe stdout and stderr into logging in order to capture everything it does. It works fine. However if there is an error throw inside logging, the error is sent to stderr that got redirect into logging again. Its seems some lock is not reentrant and it causes deadlock. >>> import logging,sys >>> # a quick and dirty log file object ... class LogFileObj(object): ... def __init__(self,log): ... self.log = log ... def write(self,str): ... self.log.warn(str) ... >>> # create a logger for stderr ... log = logging.getLogger() >>> >>> # for the purpose of showing this bug, output to a StreamHandler based on stdout ... handler = logging.StreamHandler(sys.stdout) >>> handler.setFormatter(logging.Formatter('%(asctime)s %(message)s')) >>> log.addHandler(handler) >>> >>> # redirect stderr to a logger ... sys.stderr = LogFileObj(log) >>> >>> # it works! ... print >>sys.stderr, 'hello world' 2005-10-05 22:52:32,391 hello world 2005-10-05 22:52:32,391 >>> >>> # now put sys.stderr aside ... # use the logger as usual ... log.warn('hello world') 2005-10-05 22:52:32,401 hello world >>> >>> # this one has an error in the number of arguments ... log.warn('hello world %s', 1, 2) When the last statement is ran, it goes into a deadlock. It seems this can be workaround by using threading.RLock instead of thread's lock. >>> # workaround the deadlock by using RLock ... import threading >>> handler.lock = threading.RLock() >>> log.warn('hello world %s', 1, 2) 2005-10-05 22:47:46,390 Traceback (most recent call last): 2005-10-05 22:47:46,400 File "C:\Python24\lib\logging\__init__.py", line 706, in emit 2005-10-05 22:47:46,400 msg = self.format(record) 2005-10-05 22:47:46,400 File "C:\Python24\lib\logging\__init__.py", line 592, in format 2005-10-05 22:47:46,400 return fmt.format(record) 2005-10-05 22:47:46,400 File "C:\Python24\lib\logging\__init__.py", line 382, in format 2005-10-05 22:47:46,400 record.message = record.getMessage() 2005-10-05 22:47:46,400 File "C:\Python24\lib\logging\__init__.py", line 253, in getMessage 2005-10-05 22:47:46,400 msg = msg % self.args 2005-10-05 22:47:46,400 TypeError: not all arguments converted during string formatting I'm not too familiar with the implementation of logging. Please keep me posted whether this is a legitimate workaround. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314519&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1314572 ] Trailing slash redirection for SimpleHTTPServer
Bugs item #1314572, was opened at 2005-10-05 23:49 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314572&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Feature Request Status: Open Resolution: None Priority: 5 Submitted By: Josiah Carlson (josiahcarlson) Assigned to: Nobody/Anonymous (nobody) Summary: Trailing slash redirection for SimpleHTTPServer Initial Comment: As known by every serious web server developer, the lack of a trailing slash on direcories can cause some serious web page loading issues. Take the following examples... Let us imagine that: 'http://www.foo.com/foo' points to a directory containing 'index.html'. A web server could return the contents of 'index.html', but then any relative urls would be relative to the / path of the web server. A better web server would instead redirect the user to 'http://www.foo.com/foo/'. SimpleHTTPServer does not do any such redirection, and the documentation for forcing a client to redirect is difficult to find on the internet. In the comments I will post a replacement SimpleHTTPServer.SimpleHTTPRequestHandler.send_head method which does automatic trailing slash redirection. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314572&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1314572 ] Trailing slash redirection for SimpleHTTPServer
Bugs item #1314572, was opened at 2005-10-05 23:49 Message generated for change (Comment added) made by josiahcarlson You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314572&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Feature Request Status: Open Resolution: None Priority: 5 Submitted By: Josiah Carlson (josiahcarlson) Assigned to: Nobody/Anonymous (nobody) Summary: Trailing slash redirection for SimpleHTTPServer Initial Comment: As known by every serious web server developer, the lack of a trailing slash on direcories can cause some serious web page loading issues. Take the following examples... Let us imagine that: 'http://www.foo.com/foo' points to a directory containing 'index.html'. A web server could return the contents of 'index.html', but then any relative urls would be relative to the / path of the web server. A better web server would instead redirect the user to 'http://www.foo.com/foo/'. SimpleHTTPServer does not do any such redirection, and the documentation for forcing a client to redirect is difficult to find on the internet. In the comments I will post a replacement SimpleHTTPServer.SimpleHTTPRequestHandler.send_head method which does automatic trailing slash redirection. -- >Comment By: Josiah Carlson (josiahcarlson) Date: 2005-10-05 23:58 Message: Logged In: YES user_id=341410 def send_head(self): """Common code for GET and HEAD commands. This sends the response code and MIME headers. Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do. """ path = self.translate_path(self.path) f = None if os.path.isdir(path): # Redirect path urls which lack a trailing slash if not self.path.endswith('/'): self.send_response(302) self.send_header("Content-type", "text/html") self.send_header("Content-Location", self.path + '/') self.end_headers() return StringIO(''%self.path) for index in "index.html", "index.htm": index = os.path.join(path, index) if os.path.exists(index): path = index break else: return self.list_directory(path) ctype = self.guess_type(path) try: # Always read in binary mode. Opening files in text mode may cause # newline translations, making the actual size of the content # transmitted *less* than the content-length! f = open(path, 'rb') except IOError: self.send_error(404, "File not found") return None self.send_response(200) self.send_header("Content-type", ctype) self.send_header("Content-Length", str(os.fstat(f.fileno())[6])) self.end_headers() return f -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1314572&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com