[issue18677] Enhanced context managers with ContextManagerExit and None

2022-01-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Having given this some thougt, years laters, I believe it _is_ possible to write nested() (and nested_delayed()) in a correct way in python, without the ContextManagerExit function. Behold! import contextlib @contextlib.contextmanager def

[issue18677] Enhanced context managers with ContextManagerExit and None

2022-01-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Great throwback. As far as I know, context managers are still not first class citizens. You cannot _compose_ two context managers into a new one programmatically in the language, in the same way that you can, for instance, compose two functions

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2020-03-01 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I gave up contributing a long time ago now because it was too emotionally exhausting to me. This issue was one that helped tip the scales. I hope things have become easier now because good projects like Python need the enthusiasm and spirit

[issue17639] symlinking .py files creates unexpected sys.path

2019-11-22 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: So you have already stated, and this issue is six years old now. While I no longer have a stake in this, I'd just like to reiterate that IMHO it breaks several good practices of architecture, particularly that of separation of roles. The abstraction

[issue14307] Make subclassing SocketServer simpler for non-blocking frameworks

2019-10-10 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Nice necro :) Socketserver is already subclassable and overridable for so many things. Hard to understand the reluctancy to _allow_ for a different way to handle accept timeouts. But this is also why I stopped contributing to core, because

[issue38106] Race in PyThread_release_lock - can lead to memory corruption and deadlock

2019-09-11 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: imho posix made a mistake in allowing signal/broadcast outside the mutex. Otherwise an implementation could rely on the mutex for internal state manipulation. I have my own fast condition variable lib implemented using semaphores and it is simple

[issue8410] Fix emulated lock to be 'fair'

2019-09-11 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: super, good catch! -- ___ Python tracker <https://bugs.python.org/issue8410> ___ ___ Python-bugs-list mailing list Unsub

[issue38106] Race in PyThread_release_lock - can lead to memory corruption and deadlock

2019-09-11 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Interesting. Yet another reason to always do condition signalling with the lock held, such as is good practice to avoid race conditions. That's the whole point of condition variables. -- ___ Python

[issue36402] threading._shutdown() race condition: test_threading test_threads_join_2() fails randomly

2019-08-09 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Please note that this fix appears to be the cause of #37788 -- nosy: +kristjan.jonsson ___ Python tracker <https://bugs.python.org/issue36

[issue34659] Inconsistency between functools.reduce & itertools.accumulate

2018-09-18 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I think I'll pass Raymond, its been so long since I've contributed, in the mean time there is github and argument clinic and whatnot so I'm out of training. I´m lurking around these parts and maybe shall return one day

[issue34573] Simplify __reduce__() of set and dict iterators.

2018-09-04 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Interesting, I'll have a look when I'm back from vacation. On Tue, 4 Sep 2018, 07:04 Raymond Hettinger, wrote: > > Raymond Hettinger added the comment: > > Also take a look at the other places that have similar logic. I believe >

[issue9141] Allow objects to decide if they can be collected by GC

2018-06-04 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Hi there! By the time pep 442 was introduced, I wasn't very active in python core stuff anymore, and still am not. The intent of this patch, which is explained (IMHO) quite clearly in the first few comments was to - Formalize a way for custom

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2017-11-30 Thread Kristján Valur Jónsson
Kristján Valur Jónsson <swesk...@gmail.com> added the comment: OP here, lurking. The need to load server certificates from memory is quite real. Some seven years ago I wrote custom code to handle that for CCPs python branch, and contributed patches to that effect. It's always dismaying

[issue30703] Non-reentrant signal handler (test_multiprocessing_forkserver hangs)

2017-06-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Thanks for the mention, @pitrou. CCP was using Py_AddPendingCall but not from signal handlers, but external threads. Also on windows only. You'll also be happy to know that I have left CCP and the Eve codebase is being kept stable while regularly

[issue30727] [2.7] test_threading.ConditionTests.test_notify() hangs randomly on Python 2.7

2017-06-22 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: My favorite topic :) You could use threading.Barrier() which is designed to synchronize N threads doing this kind of lock-step processing. The problem is that the Barrier() is implemented using Condition variables, so for unit-testing, Condition

[issue29897] itertools.chain behaves strangly when copied with copy.copy

2017-04-02 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: It is a tricky issue. How deep do you go?what if you are chaining several of the itertools? Seems like we're entering a semantic sinkhole here. Deepcopy would be too deep... The original copy support in these objects stems from the desire to support

[issue29871] Enable optimized locks on Windows

2017-03-22 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Hi there. Looking at the API docs today (https://msdn.microsoft.com/en-us/library/windows/desktop/ms686304(v=vs.85).aspx) it appears that the timeout case is documented. I'm fairly sure that it wasn't when I implemented it. There was a good reason

[issue13721] ssl.wrap_socket on a connected but failed connection succeeds and .peer_certificate gives AttributeError

2016-11-29 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: fyi, I just observed this in the field in 2.7.3 using requests 2.5.3 I don't think requests has a workaround for 2.7 from reading the release logs. -- nosy: +kristjan.jonsson ___ Python tracker <

[issue8800] add threading.RWLock

2016-09-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Seems to have fizzled out due to the intense amount of bikeshedding required. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/

[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-09 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: As already stated, this error bubbles up from the TCP layer. It means that the tcp stack, for example, gave up resending a tcp frame and timed out, determining that the recipient was no longer listening. You cannot create this error yourself. If you

[issue27682] Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-09 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: This error is a protocol error. It is the analog to WSAECONNRESET. ECONNRESET occurs when the local host receives a RST packet from the peer, usually because the peer closed the connection. WSAECONNABORT occurs when the local tcp layer decides

[issue27406] subprocess.Popen() hangs in multi-threaded code

2016-06-28 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson: On a quad-core raspberrypi, i have experienced that subprocess.Popen() sometimes does not return immediatelly, but only much later, when an unrelated process has exited. Debugging the issue, I find the parent process hanging

[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-06-01 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Hi there, everyone. I'm sorry for my rash remarks about the state of IDLE, I'm sure it is alive and well and its good to see that fine people like Terry are working on keeping it up to date. Michael, please understand that python developers

[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-04-25 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I think that the select.select calls there are a red herring, since I see no evidence that the rpc socket is ever put in non-blocking mode. But the line self.rpcclt.listening_sock.settimeout(10) indicates that the socket is in timeout mode, and so

[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-04-24 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Caveat emptor: I know nothing of IDLE, and I even suspect it to be dead or dying code. Non the less, it could be patched. I found this in the code: def putmessage(self, message): self.debug("putmessage:%d:" % message[0])

[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-04-24 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Hi there. I don't think this is in relation to issue #9090. That one had to do with the internal mechanisms of doing blocking IO with timeout. this is done internally by using non-blocking sockets and select(), and the backport dealt with some edge

[issue25718] itertools.accumulate __reduce__/__setstate__ bug

2015-12-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: This could be fixed by saving the accumulate state in a tuple. It would break protocol, though. I don't recall the rules for backwards compatibility of pickles. I've argued before that the state of runtime structures such as generators is so

[issue15068] fileinput requires two EOF when reading stdin

2015-12-07 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson <swesk...@gmail.com>: -- nosy: -kristjan.jonsson ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue25021] product_setstate() Out-of-bounds Read

2015-09-12 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson <swesk...@gmail.com>: -- stage: -> resolved ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue25021] product_setstate() Out-of-bounds Read

2015-09-10 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Thanks, I'll get this committed and merged asap. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25021] product_setstate() Out-of-bounds Read

2015-09-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Interesting. Let me have a look. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25021] product_setstate() Out-of-bounds Read

2015-09-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: An alternative patch. Please test this since I don't have a development system. -- keywords: +needs review Added file: http://bugs.python.org/file40404/itertoolsmodule.c.patch ___ Python tracker <

[issue25021] product_setstate() Out-of-bounds Read

2015-09-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: There are two problems with the previous patch: 1) it can put out of bounds values into lz->indices. This can cause problems then next time product_next() is called. 2) the case of a pool having zero size is not dealt with (it wasn't before eit

[issue23344] Faster marshalling

2015-02-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: looks good to me, although it has been pointed out that marshal _write_ speed is less critical than read speed :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23344

[issue22113] memoryview and struct.pack_into

2014-12-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: lgtm :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22113 ___ ___ Python-bugs-list mailing list

[issue20434] Fix error handler of _PyString_Resize() on allocation failure

2014-11-17 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Nope, closing as fixed :) -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20434

[issue14534] Add method to mark unittest.TestCases as do not run.

2014-06-18 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Just want to restate my +1 for Michael's idea. I'm hit by this all the time and it is beautiful and expressive. It also does not preclude the annoying mix-in way of doing it. -- ___ Python tracker rep

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Thanks. Can you confirm that it resolves the issue? I'll get it checked in once I get the regrtest suite run. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I see, I wasn't able to compile it yesterday when I did it :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: nope, let's not do that :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___ ___ Python-bugs

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: changing long to DWORD doesn't really fix the overflow issue. The fundamental problem is that some of the apis, e.g. WaitForSingleObject have a DWORD maximum. so, we cannot support sleep times longer than some particular time. Microseconds was chosen

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Tim, how about changing the variable to unsigned long? I'd like the signature of the function to be the same for all platforms. This will change the code and allow waits for up to 4000 seconds. There is still an overflow problem present, though

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Hi there. When I said 4000, that was because of the conversion to microseconds which happens early on. I'm not trying to be difficult here Tim, it's just that you've pointed out a problem and I'd like us to have a comprehensive fix. unsigned long

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: (cont.) so, I suggest that we modify the API to use Py_LONG_LONG usec Does that sound reasonable? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Ah, I saw this code here in thread_nt.h: if ((DWORD) milliseconds != milliseconds) Py_FatalError(Timeout too large for a DWORD, please check PY_TIMEOUT_MAX); the PyCOND_TIMEDWAIT is currently only used by the GIL

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here is a proposed alternative patch. No additional checks, just a wider Py_LONG_LONG us wide enough to accommodate 32 bits of milliseconds as before. -- Added file: http://bugs.python.org/file35175/condwait.patch

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: fix patch, was using git format -- Added file: http://bugs.python.org/file35176/condwait.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2014-04-29 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7105

[issue21220] Enhance obmalloc allocation strategy

2014-04-28 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: This significantly helps fragmentation in programs with dynamic memory usage, e.g. long running programs. On which programs? The fragmentation of the memory depends a lot on how the program allocates memory. For example, if a program has

[issue20434] Fix error handler of _PyString_Resize() on allocation failure

2014-04-17 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Add comments and explicit (void) on the ignored value from _PyString_Resize as suggested by Victor -- Added file: http://bugs.python.org/file34951/string_resize.patch ___ Python tracker rep

[issue21220] Enhance obmalloc allocation strategy

2014-04-16 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Antoine: The location of the arenas when they're individually allocated with mmap does not matter, no, but preferring to keep low address ones reduces vmem fragmentation, since they end up being clustered together in memory. For the usable-arenas

[issue21220] Enhance obmalloc allocation strategy

2014-04-16 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: sorry, I meant of course performance of pybench.py goes up -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21220

[issue21220] Enhance obmalloc allocation strategy

2014-04-16 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Sure. I'm flying home from PyCon this afternoon. I´ll produce and tabulate data once I'm home on my workstation again. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21220

[issue21220] Enhance obmalloc allocation strategy

2014-04-15 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Update patch with suggestions from Larry -- Added file: http://bugs.python.org/file34876/obmalloc.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21220

[issue20434] Process crashes if not enough memory to import module

2014-04-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I would also advocate for a better api, that leaves it up to the caller what to do, much like realloc() does. A convenience macro that frees the block on error could then be provided. But this is 2.7 and we don't change stuff there :) Can you

[issue20434] Process crashes if not enough memory to import module

2014-04-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: This is _PyString_Resize(). I don't immediatlly see an error case where the string isn't freed: int _PyString_Resize(PyObject **pv, Py_ssize_t newsize) { register PyObject *v; register PyStringObject *sv; v = *pv; if (!PyString_Check(v

[issue20434] Process crashes if not enough memory to import module

2014-04-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Ok, are we good to go then? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20434 ___ ___ Python-bugs

[issue21220] Enhance obmalloc allocation strategy

2014-04-14 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson: A new allocation policy, lowest address strategy improves fragmentation of memory in obmalloc. pools with available memory are chosen by lowest address preference. This increases the likelihood that unused pools are released to their corresponding

[issue20434] Process crashes if not enough memory to import module

2014-04-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Sure, there was at least one case in the patch, where the string resize was consider optional, and the code tried to recover if it didn't succeed. But I don't think we should be trying to change apis, even internal ones in python 2.7

[issue21220] Enhance obmalloc allocation strategy

2014-04-14 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21220 ___ ___ Python-bugs

[issue20434] Process crashes if not enough memory to import module

2014-04-10 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Could someone please review this patch? I'd like to see it committed asap. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20434

[issue20434] Process crashes if not enough memory to import module

2014-04-10 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Ok, retrying without the --git flag (I thought that was recommended, it was once...) -- Added file: http://bugs.python.org/file34784/string_resize.patch ___ Python tracker rep...@bugs.python.org http

[issue20434] Process crashes if not enough memory to import module

2014-04-10 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: Removed file: http://bugs.python.org/file34779/string_resize.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20434

[issue20434] Process crashes if not enough memory to import module

2014-04-09 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here we are. There were a lot of places where this was being incorrectly done. And some places where this was being considered a recoverable error, which it isn't because the source is freed. Which sort of supports my opinion that this is bad

[issue17522] Add api PyGILState_Check

2014-04-04 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17522

[issue16475] Support object instancing and recursion in marshal

2014-04-04 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475

[issue17969] multiprocessing crash on exit

2014-04-04 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Closing this as won-t fix. Exiting with running threads is a can of worms. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17969

[issue8410] Fix emulated lock to be 'fair'

2014-04-04 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Closing this issue. It is largely superseded. For our Python 2.7 branches, we have a custom GIL lock which can have different inherent semantics from the common Lock. In particular, we can implement a fair PyGIL_Handoff() function to be used

[issue8410] Fix emulated lock to be 'fair'

2014-04-04 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- resolution: - rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8410

[issue17969] multiprocessing crash on exit

2014-04-04 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- resolution: - wont fix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17969

[issue17522] Add api PyGILState_Check

2014-04-04 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- resolution: - fixed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17522

[issue16475] Support object instancing and recursion in marshal

2014-04-04 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- resolution: - fixed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16475

[issue15139] Speed up threading.Condition wakeup

2014-04-04 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: In our 2.7 branches, this approach has been superseded with a natively impolemented _Condition class. This is even more efficient. It is available if the underlying Lock implementation is based on pthread locks (not semaphores

[issue19009] Enhance HTTPResponse.readline() performance

2014-03-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Sure. If there are issues we'll just reopen. Closing. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19009

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Are you referring to the Py_LOCAL_INLINE macro? I see that we have no Py_INLINE. Py_LOCAL_INLINE includes the static qualifier, and in fact, if there is no USE_INLINE defined, then all that it does is to add static. Would having a Py_INLINE(type

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Well, Larry, I certainly am in no mood to start wrangling on python-dev. A 25 year old C standard is likely to be very mature and reliable by now. Why take risks? :) #Py_LOCAL_INLINE exists and demonstrates that we can make use of them when

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Barring c++, are we using any C compilers that don't support inlines? Imho these macros should be functions proper. Then we could do Py_Assign(target, Py_IncRef(obj)) It's 2014 already. -- ___ Python

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-25 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Better yet, embrace c++ and smart pointers :;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: These macros work as assignment with builtin decref, i.e. a smart replacement for = We could resolve this by calling them Py_ASSIGN Py_XASSIGN and having complementary macros Py_STORE/Py_XSTORE that will incref the new value. However, with an added

[issue14911] generator.throw() documentation inaccurate

2014-02-04 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Note that the docstring does not match the doc: PyDoc_STRVAR(throw_doc, throw(typ[,val[,tb]]) - raise exception in generator,\n\ return next yielded value or raise StopIteration.); Should I change the docstring too

[issue14911] generator.throw() documentation inaccurate

2014-02-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here's one for 2.7. I'm still looking at 3. The funny thing is that the signature of generator.throw reflects 2.x conventions. I'm figuring out if it can be used with the .with_traceback() idiom -- keywords: +patch Added file: http

[issue14911] generator.throw() documentation inaccurate

2014-02-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: And 3.x -- Added file: http://bugs.python.org/file33888/3x.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14911

[issue20434] Process crashes if not enough memory to import module

2014-01-31 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: These are very unusual semantics. The convention in the python api is that functions are refernece-invariant when there are errors. i.e. if a function fails or not does not change the caller's reference passing assumptions. For example, Py_BuildValue

[issue20434] Process crashes if not enough memory to import module

2014-01-31 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I'm not talking about the PyObject** argument, Victor. I'm talking about reference counting semantics. It is a rule that reference counting semantics should be the same over a function call whether that function raised an exception

[issue7464] circular reference in HTTPResponse by urllib2

2013-12-30 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: No, the socket is actually closed when response's close() method is called. The problem is that the HTTPResponse object, buried deep within the nested classes returned from do_open(), has a circular reference, and _it_ will not go away. No one

[issue7464] circular reference in HTTPResponse by urllib2

2013-12-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here it is. Notice the incredible nesting depth in python 2.7. The socket itself is found at response.fp._sock.fp._sock There are two socket._fileobjects in use! -- Added file: http://bugs.python.org/file33205/httpleak.py

[issue7464] circular reference in HTTPResponse by urllib2

2013-12-18 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: This is still a horrible, horrible, cludge. I've recently done some work in this area and will suggest a different approach. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7464

[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-12-04 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: That's the spirit, Guido :) I just think people are being extra careful after the regression introduced in 2.7.5. However, IMHO we must never let the odd mistake scare us from making necessary moves. Unless Antoine explicitly objects, I think I'll

[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-12-04 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: +1 Why don't we just fix this and see where the chips fall? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19787

[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-12-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Strictly speaking b) is not a semantic change. Depending on your semantic definition of semantics. At any rate it is even less so than a) since the temporary list is hidden from view and the only side effect is additional memory usage

[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-12-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: d), We could also simply issue a (documentation) warning, that the iterator methods of these dictionares are known to be fragile, and recommend that people use the keys(), values() and items() instead

[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-12-02 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Yes, the old memory argument. But is it valid? Is there a conceivable application where a dict of weak references would be storing a large chunk of the application memory? Remember, all of the data must be referred to from elsewhere, or else, the weak

[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-12-01 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here's a different approach. Simply avoid the use of iterators over the underlying container. Instead, we iterate over lists of items/keys/values etc. -- Added file: http://bugs.python.org/file32932/weakref.patch

[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Deja vu, this has come up before. I wanted to change this because native TLS implementation become awkward. https://mail.python.org/pipermail/python-dev/2008-August/081847.html -- ___ Python tracker rep

[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: See also issue #10517 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19787 ___ ___ Python-bugs-list

[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: But yes, I'd like to see this behave like normal. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19787

[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Please see the rather long discussion in http://bugs.python.org/issue10517 There were issues having to do with fork. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19787

[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-28 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Only that issue #10517 mentions reasons to keep the old behavior, specifically http://bugs.python.org/issue10517#msg134573 I don't know if any of the old arguments are still valid, but I suggested changing this years ago and there was always some

[issue7105] weak dict iterators are fragile because of unpredictable GC runs

2013-11-19 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: No matter how it sounds, it certainly looks cleaner in code. Look at all this code, designed to work around an unexpected GC collection with various pointy bits and edge cases and special corners. Compare to explicitly just asking GC to relent

  1   2   3   4   5   6   7   8   9   10   >