[Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Michael Hudson
I've just fixed a bug where Py_INCREF wasn't called when it should have been before a call to PyModule_AddObject (rev. 2.62 of Modules/threadmodule.c). So I went looking for other instances of the same problem. I didn't find any (though I don't understand how _csv.c gets away with line 1579), but

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Skip Montanaro
Michael> So I went looking for other instances of the same problem. I Michael> didn't find any (though I don't understand how _csv.c gets away Michael> with line 1579)... Same reason the Py_INCREF of ProfileError isn't necessary I think. PyDict_New() returns a new reference which is

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Michael Hudson
Skip Montanaro <[EMAIL PROTECTED]> writes: > Michael> So I went looking for other instances of the same problem. I > Michael> didn't find any (though I don't understand how _csv.c gets away > Michael> with line 1579)... > > Same reason the Py_INCREF of ProfileError isn't necessary I t

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Skip Montanaro
Michael> ... (though I don't understand how _csv.c gets away Michael> with line 1579)... Michael> Oops; I meant line 1590. Hmmm... Me either. Is it possible it was just never DECREF'd? I checked in the obvious fix on both head and the 2.4 release branch. Skip

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Armin Rigo
Hi Michael, On Wed, Jun 15, 2005 at 01:35:35PM +0100, Michael Hudson wrote: > if (ProfilerError == NULL) > ProfilerError = PyErr_NewException("hotshot.ProfilerError", >NULL, NULL); > if (ProfilerError != NULL) { >

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Michael Hudson
Armin Rigo <[EMAIL PROTECTED]> writes: > Hi Michael, > > On Wed, Jun 15, 2005 at 01:35:35PM +0100, Michael Hudson wrote: >> if (ProfilerError == NULL) >> ProfilerError = PyErr_NewException("hotshot.ProfilerError", >>NULL, NULL); >

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-15 Thread Martin v. Löwis
Michael Hudson wrote: > if (ProfilerError == NULL) > ProfilerError = PyErr_NewException("hotshot.ProfilerError", >NULL, NULL); > if (ProfilerError != NULL) { > Py_INCREF(ProfilerError); > PyModule_A

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-16 Thread Michael Hudson
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Michael Hudson wrote: > >> if (ProfilerError == NULL) >> ProfilerError = PyErr_NewException("hotshot.ProfilerError", >>NULL, NULL); >> if (ProfilerError != NULL) { >>

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-17 Thread Martin v. Löwis
Michael Hudson wrote: > I've been looking at this area partly to try and understand this bug: > > [ 1163563 ] Sub threads execute in restricted mode > > but I'm not sure the whole idea of multiple interpreters isn't > inherently doomed :-/ That's what Tim asserts, saying that people who want

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-18 Thread Michael Hudson
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Michael Hudson wrote: >> I've been looking at this area partly to try and understand this bug: >> >> [ 1163563 ] Sub threads execute in restricted mode >> >> but I'm not sure the whole idea of multiple interpreters isn't >> inherently doomed :-

Re: [Python-Dev] refcounting vs PyModule_AddObject

2005-06-23 Thread Tim Peters
[Michael Hudson] >> I've been looking at this area partly to try and understand this bug: >> >> [ 1163563 ] Sub threads execute in restricted mode >> >> but I'm not sure the whole idea of multiple interpreters isn't >> inherently doomed :-/ [Martin v. Löwis] > That's what Tim asserts, saying t