[issue11721] socket.accept() with a timout socket creates bogus socket

2011-03-30 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson : -- resolution: -> duplicate status: open -> closed superseder: -> On Mac / BSD sockets returned by accept inherit the parent's FD flags ___ Python tracker <http://bugs.pyth

[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2011-03-30 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: socket.defaulttimeout(None) s = socket.socket() s.settimeout(0) #nonblocking s.bind() s2, a = s.accept() print s2.gettimeout() #prints ´none´, meaning blocking s2.receive(10) #raises EWOULDBLOCK error, since internally it is non-blocking I don't

[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2011-03-30 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Antoine, absolument. Please see attached file bug.py As for a different patch, we should agree what behaviour should be expected. I don't think it is possible to rely on some platform specific behaviour. This is because it is in genera

[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2011-03-31 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I can't see how that patch has anything to do with it. The problem has been present since at least 2.5. Your patch fixed it for timeout>0.0 but left the 0.0 case still broken. It comes from these lines in init_sockobject: { s->s

[issue2202] urllib2 fails against IIS 6.0 (No support for MD5-sess auth)

2011-04-11 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Is this moving anywhere? I was asked to apply this patch locally and am curious as to whether it is moving into the stdlib. -- nosy: +krisvale ___ Python tracker <http://bugs.python.org/issue2

[issue10517] test_concurrent_futures crashes with "--with-pydebug" on RHEL5 with "Fatal Python error: Invalid thread state for this thread"

2011-04-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Now, I'd be super happy to see this strange semantics of PyThread_set_key_value go away. Its very un-standard and complicates the mapping from an native implementation to the python one. But I think I did once bring up this issue, and was told

[issue10517] test_concurrent_futures crashes with "--with-pydebug" on RHEL5 with "Fatal Python error: Invalid thread state for this thread"

2011-04-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Antoine, I wonder if we can restore PyThread_set_key_value to behave like a canonical TLS api function (always setting) but fix the cases that want to "set if it has not already been set" like the cases you mention. It is very unorthodox to

[issue10517] test_concurrent_futures crashes with "--with-pydebug" on RHEL5 with "Fatal Python error: Invalid thread state for this thread"

2011-04-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Ah, using the fallback implementation of tls? Surely this isn't a problem with the pthreads tls, I'd be surprised if it retains TLS values after fork. -- ___ Python tracker <http://bu

[issue3974] collections.namedtuple uses exec to create new classes

2011-05-12 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Yes, exec is unholy:) For embedding Python into a console game we have removed the python compiler. exec and eval don't work. This saves space and is also a security feature. I had to modify the collections module so that namedtuple() just re

[issue10260] Add a threading.Condition.wait_for() method

2010-11-18 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Committed as revision 86510 -- resolution: -> accepted status: open -> closed ___ Python tracker <http://bugs.python.org/i

[issue10430] _sha.sha().digest() method is endian-sensitive. and hexdigest()

2010-11-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Something is definietly weird on the PS3. I´ll give more concrete data soon. (and yes, I may have misread the code) -- ___ Python tracker <http://bugs.python.org/issue10

[issue10430] _sha.sha().digest() method is endian-sensitive. and hexdigest()

2010-11-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Yes, in my original myopic observation I was mistaken in thinking that we were reading the digest out of the 5 entry int32 "digest" field in the SHAobject. I´ve already verified that the "Endianness" field is correctly set. Wh

[issue10501] make_buildinfo regression with unquoted path

2010-11-22 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Ah yes, spaces in filenames. One always forgets. Fixed the make_buildinfo.c (quote whole string, not just part of it) and committed in revision 86689 -- resolution: -> accepted status: open ->

[issue10501] make_buildinfo regression with unquoted path

2010-11-22 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I did various tests and quoting parts of the path seemed fragile, especially if the quote landed next to a backslash. This is dangerous ground :) -- ___ Python tracker <http://bugs.python.org/issue10

[issue10430] _sha.sha().digest() method is endian-sensitive. and hexdigest()

2010-11-24 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Found the issue and it wasn't with sha1. Turned out that the code was doing somethign like sha1(buffer(unicode('str'))) which exposed the endianness of the unicode representation. Sorry for wasting your time. -- resolution: -&

[issue10538] PyArg_ParseTuple("s*") does not always incref object

2010-11-26 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : The new "s*" code for PyArg_ParseTuple is used to fill a Py_buffer object from the arguments. This object must be relased using PyBuffer_Release() after use. However, if the object in the tuple does not support the new buffer interface

[issue10538] PyArg_ParseTuple("s*") does not always incref object

2010-11-26 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson : -- versions: -Python 3.2 ___ Python tracker <http://bugs.python.org/issue10538> ___ ___ Python-bugs-list mailing list Unsub

[issue10553] Add optimize argument to builtin compile() and byte-compilation modules

2010-11-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: This looks fairly complete. I spotted the word "optimze" in there :) As for the C api, I always cringe when I add an "Ex" function myself, because it feels like I'm spending my last bullet. What to do if I need yet another pa

[issue10576] Add a progress callback to gcmodule

2010-11-29 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : As discussed here: http://mail.python.org/pipermail/python-ideas/2010-November/008813.html: Adding the ability to register callbacks to be invoked before and after garbage collection runs. This can be used to gather run-time statistics such as

[issue10576] Add a progress callback to gcmodule

2010-11-30 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Hi, as I stated, the original patch was simply our original implementation. Here is a new patch. It is simpler: 1) it exposes a gc.callbacks list where users can register themselves, in the spirit of sys.meta_path 2) One can have multiple callbacks 3

[issue10576] Add a progress callback to gcmodule

2010-11-30 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: You are right, Antoine. How about a string and a dict? the string can be "start" and "stop" and we can add interesting information to the dict as you suggest. -- ___ Python tracker <

[issue10576] Add a progress callback to gcmodule

2010-12-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: 1) I'm not sure what you are asking. Does anyone think that it is simpler to register two different callbacks than one? IMHO it complicates the interface and creates so many oppertunities to do things incorrectly. 2)No, it is an oversight, l

[issue10576] Add a progress callback to gcmodule

2010-12-05 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here is a third patch. The callback now gets two argument, phase and info. I've added documentation and unittests. -- Added file: http://bugs.python.org/file19946/gccallback3.patch ___ Python tracker

[issue8194] Incompatible API change in xmlrpclib.Transport.parse_response() of Python 2.7 and 3.2

2010-12-06 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: The patch looks fine to me. If it runs and everyone is happy, by all means lets put it in. (I agree that the zlib stuff _should_ be handled elsewhere, but for reasons of expediency it was put into this module

[issue10683] PreLinkEvent error under VC2010

2010-12-12 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Yes, I have VC2010 so I'll see what happens... -- ___ Python tracker <http://bugs.python.org/issue10683> ___ ___

[issue10683] PreLinkEvent error under VC2010

2010-12-12 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Ok the problem is this line in the pre-link step, that must have gotten changed during the conversion: "$(SolutionDir)make_buildinfo.exe" Debug "$(IntDir)" should be "$(SolutionDir)make_buildinfo.exe" Debug "$(IntDi

[issue10683] PreLinkEvent error under VC2010

2010-12-12 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Implemented the "trailing quote removal" defensive programming strategy in revision 87205. Others that autoconvert the solution will not be hit by this problem. -- resolution: -> fixed status: o

[issue10538] PyArg_ParseTuple("s*") does not always incref object

2010-12-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Well, I can submit a patch if anyone is interested. I came across this when writing asynchronous network code. By hanging onto the Py_buffer, I should have access to the data during the network call. But it only worked for "true" Py_buff

[issue10576] Add a progress callback to gcmodule

2010-12-22 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Uh oh. I forgot about this and there now we have passed beta 2. Didn't anyone want to review the patch? -- ___ Python tracker <http://bugs.python.org/is

[issue10576] Add a progress callback to gcmodule

2010-12-24 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Well, the idea is good and it did cross my mind. Particularly it could be useful for performance sensitive applications. However it complicates things. 1) If a GC is rejected, when do we make the next attempt? 2) If a callback cancels GC, then what

[issue10576] Add a progress callback to gcmodule

2010-12-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: 1) what I mean is that if a callback rejects GC, the GC algorithm may find its condition for invoking GC in the first place to be still valid immediately afterwards, so doing a GC will be immediately retried. I have to check, but it could mean that

[issue10296] ctypes catches BreakPoint error on windows 32

2010-12-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I _think_ that in our old 2.5 python (which had a backported ctypes from 2.6 to support 64 bits) we always got the JIT debugger i.e. with _ctypes.pyd and _ctypes_d.pyd. This api, "DebugBreak" always invokes the JIT debugger, however the p

[issue11034] Build problem on Windows with MSVC++ Express 2008

2011-01-28 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Bizarre indeed. I think more quotes is the answer, since it is simpler to implement. But the question remains, why has it worked until now? -- ___ Python tracker <http://bugs.python.org/issue11

[issue3327] NULL member in modules_by_index

2008-07-09 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: In _PyState_AddModule(), a list of (initially) 20 elements is created, but there is no guarantee that all elements are initialized. In particular, it appears that element 0 is always NULL. This is bad since this l

[issue3367] Uninitialized value read in parsetok.c

2008-07-15 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: If a PyTokenizer_FromString() is called with an empty string, the tokenizer's line_start member never gets initialized. Later, it is compared with the token pointer 'a' in parsetok.c:193 and that behavior ca

[issue3327] NULL member in modules_by_index

2008-07-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Added a patch for this issue. Please comment. -- keywords: +easy, patch Added file: http://bugs.python.org/file10899/tmp2.patch ___ Python tracker <[EMAIL PROTECTE

[issue3368] Memory leak in import.c

2008-07-15 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: Failure to deallocate a buffer returned by PyArg_ParseTuple. Patch is attached. Found using purify while running the testsuite. -- components: Interpreter Core files: tmp3.patch keywords: easy, patch, patch me

[issue3369] memory leak in floatobject.c

2008-07-15 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: When a nan or inf is generated in PyFloat_FromString(), a temporary buffer may be left behind. Patch attached. Found using Purify -- components: Interpreter Core files: tmp4.patch keywords: easy, patch, patch me

[issue3369] memory leak in floatobject.c

2008-07-15 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson <[EMAIL PROTECTED]>: -- type: -> resource usage ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.py

[issue3367] Uninitialized value read in parsetok.c

2008-07-15 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson <[EMAIL PROTECTED]>: -- versions: +Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3367> ___

[issue3377] Invalid child node access in ast.c

2008-07-16 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: Purify complained about reading uninitialized memory in ast.c:752 of two bytes which corresponds to the type field. Looking into this, line 750 increments i without checking that there are in fact this many children. If y

[issue3378] Memory leak in pythonrun.c

2008-07-16 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: In some cases, an error string generated by parsetok.c is not cleared by err_input(). A patch is provided. -- components: Interpreter Core files: tmp5.patch keywords: patch, patch messages: 69788 nosy: krisvale se

[issue3387] undefined array passed to CryptGenRandomBytes

2008-07-16 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: The CryptGenRandomBytes uses whatever data is already in the buffer as seed for the output. So, the buffer is effectively an in/out buffer. Now, since we are generating random data anyway, the fact that we are us

[issue3582] thread_nt.c update

2008-08-17 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: Here is a suggested update to thread_nt.c. It has two significant changes: 1) it uses the new and safer _beginthreadex API to start a thread 2) it implements native TLS functions on NT, which are certain to be as fast as po

[issue3677] importing from UNC roots doesn't work

2008-08-25 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: When executing a script from a UNC path, e.g. //myhost/exports/a.py, r"\\myhost\exports" gets prepended to sys.path. But it doesn't work. This means that in a.py, "import b" will fail even thou

[issue3677] importing from UNC roots doesn't work

2008-08-25 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Correction: The workaround is to _append_ a backslash. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue3367] Uninitialized value read in parsetok.c

2008-10-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Now that the 'easy' keyword is absent, I'm afraid this is out of my depth. I'll run purify again and try to find the exact repro case. ___ Python tracker

[issue3677] importing from UNC roots doesn't work

2008-10-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: No, not really. Again, I refer to defect 954115 by glchapman. And note that those functions added there are actually not used. I was hoping that there was someone here more familiar with importing on PC. I'll go and see

[issue7741] Allow multiple statements in code.InteractiveConsole.push

2010-01-19 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : The code.InteractiveConsole() is useful to emulate a python console. However, any code currently "push"ed to it must be single statements. This is because it passes the ´single´ symbol mode to the underlying compile function. This patch

[issue7741] Allow multiple statements in code.InteractiveConsole.push

2010-01-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Note, there are no regression tests for the code module. -- ___ Python tracker <http://bugs.python.org/issue7

[issue7741] Allow multiple statements in code.InteractiveConsole.push

2010-01-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here is how to test this manually: from code import InteractiveConsole c = InteractiveConsole() s = "if True:\n print 1\nprint 2" c.push(s) #fails c.push(s, "exec") #succeeds -- ___ P

[issue8212] A tp_dealloc of a subclassed class cannot resurrect an object

2010-03-23 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : The tp_dealloc of a type can chose to resurrect an object. the subtype_dealloc() in typeobject.c does this when it calls the tp_del() member and it has increased the refcount. The problem is, that if you subclass a custom C object, and that C

[issue8299] Improve GIL in 2.7

2010-04-03 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : This patch does several things: 1) Creates a separate lock type PyThread_type_gil and locking functions for that. This allows tweaking of the GIL without affecting regular lock behaviour. 2) Creates a uniform implementation of the GIL on windows

[issue8299] Improve GIL in 2.7

2010-04-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Martin: Well, this patch was originally conceived more as a demonstration of the GIL problem and an alternative fix proposal. However, it is possible to configure it so that there is no change from existing functionality, simply by not including

[issue8299] Improve GIL in 2.7

2010-04-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Antoine: Please take a look, the change is really simple, particularly the ROUNDROBIN_GIL variant which fixes the originally observed problem. the GIL is still a lock, implemented using a mutex and a semaphore. It is modified to work exactly as the

[issue8299] Improve GIL in 2.7

2010-04-05 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Sorry, what I meant with the "original problem" was the phenomenon observed by Antoine (IIRC) that the same CPU thread tends to hog the gil, even when releaseing it in ceval.c. What I have been looking at up to now is chiefly IO perform

[issue8299] Improve GIL in 2.7

2010-04-06 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I just did some profiling. I´m using visual studio team edition which has some fancy built in profiling. I decided to compare the performance of the iotest.py script with two cpu threads, running for 10 seconds with processor affinity enabled and

[issue8299] Improve GIL in 2.7

2010-04-06 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: The counter is "stall cycles". During the 10 second run on my 2.4Ghz cpu, we had instruction cache miss stalls for 2 billion cycles (2000 samples of 100 cycles per sample). That does account for around 10% of the availible cpu. I&#

[issue8299] Improve GIL in 2.7

2010-04-09 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: David, yes messing about with processor affinities is certainly not nice. Especially since the issue is cross-platform. The pthreads api doesn't offer much. There is pthreadd_setschedparam(), and pthreads_setconcurrency(). Unfortunately I don&#

[issue8299] Improve GIL in 2.7

2010-04-11 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I looked at ccbench. It's a great tool. I've added two features to it (see the attached patch) -y option to turn off the "do_yield" option in throughput, and so measure thread scheduling without assistance, and the throug

[issue8299] Improve GIL in 2.7

2010-04-11 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Fyi, here is the output using the unmodified Windows GIL, i.e. without my patch being active: C:\pydev\python\trunk\PCbuild>python.exe ..\Tools\ccbench\ccbench.py -t -y == CPython 2.7a4+.0 (trunk) == == AMD64 Windows on 'Intel64 Family 6

[issue8299] Improve GIL in 2.7

2010-04-11 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: David, I don't necessarily think it is reasonable to yield every 100 opcodes, but that is the _intent_ of the current code base. Checkinterval is set to 100. If you don't want that, then set it higher. Your statement is like saying: &quo

[issue8299] Improve GIL in 2.7

2010-04-13 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Maybe the state of this discussion is my fault for not being clear enough. Let's abandon terms such as "broken" and "roundrobin." CS theory has the perfectly useful terms "fair" and "unfair." Th

[issue8299] Improve GIL in 2.7

2010-04-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here is yet another point: if _POSIX_SEMAPHORES is defined, thread_pthread.h is designed to use the (fair) semaphore. If it is not present, or HAVE_BROKEN_POSIX_SEMAPHORES defined, the semaphore is supposed to be emulated using a condition variable

[issue8299] Improve GIL in 2.7

2010-04-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Oh dear. I was assuming that the mutex+condition variable were the actual implementation mostly in use on pthreads. This is because of David's GIL open talk at pycon, where we were looking at the source and bickering about the placeme

[issue8299] Improve GIL in 2.7

2010-04-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Yes, we put #error in both places (defining and undefining USE_SEMAPHORES). The colleague in question is Christian Tismer, he is unlikely to have gotten it wrong. I am also curious why David Beazley kept talking about the "binary semaphore&quo

[issue8299] Improve GIL in 2.7

2010-04-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: You do realize, that if we enable the USE_SEMAPHORE, we get the GIL behaviour as seen on windows and with my ROUNDROBIN_GIL implementation, right? Also, at the GIL open space talk on PyCon, David did show us the "emulation" source code as

[issue8299] Improve GIL in 2.7

2010-04-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: David, I urge you to reconsider: The "emulated" semaphore is broken because it is unfair. It is clearly a programming error, born out of naivete about how to implement such primitives. Proper semaphores therefore cannot be implemented

[issue8299] Improve GIL in 2.7

2010-04-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Googling a bit gave me this: http://lists.apple.com/archives/darwin-kernel/2005/Dec/msg00022.html It would appear that mac os X was at least lacking full posix semaphore support in 2005. -- ___ Python

[issue8410] Fix emulated lock to be 'fair'

2010-04-15 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : On pthreads plaforms, if the posix_sem functions aren't available (when _POSIX_SEMAPHORES isn't defined), the python lock is implemented with a mutex and a condition variable. This appears to be the case on Mac OS X, for example. The

[issue8411] Improve condition variable emulation on NT

2010-04-15 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson : As per Antoine's suggestion, here is a patch to improve condition variable emulation on windows. By using the windows Semaphore (which hasn't always been available) all of the problems in emulating condition variables using Events disa

[issue8410] Fix emulated lock to be 'fair'

2010-04-16 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Martin, it isn't the condition variable which is unfair, but how the constructed locking apparatus is unfair that is the problem. This lock is written by a Tim, whom I assume to be Tim Peters. I quote his comment: "In general, if the

[issue8299] Improve GIL in 2.7

2010-04-16 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: What your fair.py is doing is demonstrating the superior behaviour of a time-based GIL interrupt to a bytecode based one. I have no quibbles with that and I agree that it is superior. But I also think that your example is a very artificial one. On

[issue8299] Improve GIL in 2.7

2010-04-17 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: >I'm not trying to be a pain here, but do you have any explanation as to >why, >with fair scheduling, the observed execution time of multiple CPU->bound >threads is substantially worse than with unfair scheduling? Yes. This is b

[issue8299] Improve GIL in 2.7

2010-04-18 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Martin, I´ve explained it in my other dissue, issue 8411, with a step by step example. It is unfair because a thread can _bypass_ the condition variable. A thread just woken up from the condition variable has to race to get the lock, and it is a

[issue8410] Fix emulated lock to be 'fair'

2010-04-18 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Is it possible that unistd.h isn't included by Python on mac builds? perhaps the config script is broken and HAVE_UNISTD_H doesn't get defined. I'll have a look at the generated pyconfig.h file on my colleague

[issue8410] Fix emulated lock to be 'fair'

2010-04-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Also, _POSIX_SEMAPHORES must be defined to be greater than 200112L. If it isn't, then it isn't supported. -- ___ Python tracker <http://bugs.python.

[issue8410] Fix emulated lock to be 'fair'

2010-04-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: In 2), B is indeed signaled and the OS makes it "runnable". But it doesn´t run immediately. A is still running. There is no need for A to stop running until it runs out of timeslice. Meanwhile the OS has to put B on a separate core (w

[issue8299] Improve GIL in 2.7

2010-04-20 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Sorry Martin, I meant issue 8410. I have so many of these going on :) -- ___ Python tracker <http://bugs.python.org/issue8

[issue8299] Improve GIL in 2.7

2010-04-20 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: It is interesting to see, David, the difference in the behaviour of the semaphore based and condition variable based lock on linux. It is clear that the semaphore and the condition varable have different queuing characteristics. I wouldn'

[issue8299] Improve GIL in 2.7

2010-04-21 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: David, trying to get some more realistic IO benchmarks I did some more tests. The idea is to have a threaded socket server, serving requests that take different amounts of time to process, and see how io response measures up for two classes of

[issue8299] Improve GIL in 2.7

2010-04-21 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Sorry, all the benchmarks were missing from my last comment. Here they are: total time avg time/request stddev LEGACY_GIL serial ((30, 500), (2.6908777512225717, 0.08968708313486773

[issue4174] Performance optimization for min() and max() over lists

2008-10-22 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: This adds a special case for min() and max() when iterating over lists. For simple lists of floats, the improvement is some 15% on a windows machine using release build (non pgo) -- components: Interpreter Core

[issue4207] Remove backwards compatibility in _heapq for performance

2008-10-26 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: Comparing _heapq with our own legacy C implementation, blue.heapq at CCP, I noticed that ours was somewhat faster. I discovered that a lot of effort is being spent to dynamically search for a __lt__ operator, to provide bac

[issue4207] Remove backwards compatibility in _heapq for performance

2008-10-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: I am sorry for not doing my research about the age of the compatibility fix. However, modifying the test slightly to work with tuples of (random.random(), random.random()) shows a performance increase from: heapify 0.366187

[issue4293] Thread Safe Py_AddPendingCall

2008-11-10 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Okay, i add a new patch that includes tests. I am unsure where I should add documentation for the Py_AddPendingCall () function. Any suggestions? Added file: http://bugs.python.org/file11978/pendingalls

[issue4293] Thread Safe Py_AddPendingCall

2008-11-10 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file11974/pendingalls.patch ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue4293] Thread Safe Py_AddPendingCall

2008-11-10 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: At CCP We have started using the Py_AddPendingCall() mechanism to signal python about a completed IO operation. However, we noticed that the existing mechanism was hoplelessly un- thread safe. This is bad, since on Wind

[issue4293] Thread Safe Py_AddPendingCall

2008-11-10 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Good point. I'll make a test using ctypes and _testcapimodule.c to try to make it as non-platform-specific as possible. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.

[issue4293] Thread Safe Py_AddPendingCall

2008-11-12 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Right. Isn't the best way to avoid it to block signals just while we pop the queue? I'll see if python has a portable sigaction thing to do that. Otherwise we'd have to start to mess with a "volatile busy

[issue4293] Thread Safe Py_AddPendingCall

2008-11-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Here is a revised version. Since there is no portable way to block signals, and no way at all on windows (apparently) the simplest way is to simply use NOWAIT_LOCK when adding a new pending call. While this does not guarante

[issue3327] NULL member in modules_by_index

2008-11-17 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: bump. Is there any interest in this fix? ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue4336] Fix performance issues in xmlrpclib

2008-11-17 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson <[EMAIL PROTECTED]>: There are two performance problems in xmlrpclib.py: POST requests use two send() calls, one to send the headers and one to send the data. This can invoke the Nagle/Delayed ACK performance problem. On many socket implement

[issue4293] Thread Safe Py_AddPendingCall

2008-11-17 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Small refinement: Deadlock avoidance is only needed on the main thread since we only install signal handlers for the main thread. Added file: http://bugs.python.org/file12031/pendingalls

[issue4293] Thread Safe Py_AddPendingCall

2008-11-17 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: I had forgotten that locks aren't initialized until PyEval_InitThreads () is called. Now we check for this case. Also reinitialize when fork () is called. Is there any suggested place where I should add documentation to t

[issue4293] Thread Safe Py_AddPendingCall

2008-11-17 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: I turns out that for SIGINT, windows creates a new thread. So, the assumption that signals are delivered on the main thread are not valid in general. Therefore, we must initialize the lock pending_lock independen

[issue4336] Fix performance issues in xmlrpclib

2008-11-21 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Just a thought here: Maybe it would be better just to change socket._fileobject to always use a minimum of 8k readbuffer for readline() just as read() already does. The read() documentation states that recv(1) is very ineff

[issue4336] Fix performance issues in xmlrpclib

2008-11-25 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: I have addressed some issues mentioned: 1) I have retained the _send_output() method. 2) the endheaders() method now takes an optional argument, send_data that defaults to True. It also returns any unsent data as a string.

[issue4336] Fix performance issues in xmlrpclib

2008-11-25 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: Sorry, I meant : "you may have concerns regarding point 2) above" ___ Python tracker <[EMAIL PROTECTED]> <http://

[issue4336] Fix performance issues in xmlrpclib

2008-11-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <[EMAIL PROTECTED]> added the comment: I like the suggestion of having endheaders() accept any extra data. I have uploaded a new patch which implements this idea. It simplifies things a lot. The issue with the read buffer size is still open. I have sent an em

<    1   2   3   4   5   6   7   8   9   10   >