Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[ python-Bugs-723205 ] PyThreadState_Clear() docs incorrect

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


noreply at sourceforge

Oct 17, 2006, 12:57 PM

Post #1 of 1 (181 views)
Permalink
[ python-Bugs-723205 ] PyThreadState_Clear() docs incorrect

Bugs item #723205, was opened at 2003-04-17 18:12
Message generated for change (Comment added) made by theller
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=723205&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: Documentation
Group: None
>Status: Deleted
Resolution: None
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Nobody/Anonymous (nobody)
Summary: PyThreadState_Clear() docs incorrect

Initial Comment:
The docs state that the GIL must be held while
PyThreadStare_Clear() is called. This seems incorrect,
at least in Python 2.2 the thread state must not be
NULL under certain conditions.

See:
http://mail.python.org/pipermail/python-dev/2003-April/034574.html


----------------------------------------------------------------------

>Comment By: Thomas Heller (theller)
Date: 2006-10-17 21:57

Message:
Logged In: YES
user_id=11105

I retract this request.

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2003-04-17 20:36

Message:
Logged In: YES
user_id=11105

Sorry, that's because I'm still confused about thread
states, and I think the experts ;-) should sort this out.

No, I'm not claiming that the GIL does not need to be held,
I'm claiming that this is not sufficient: *in addition* the
current threadstate must not be NULL.

To quote from the mentioned posts:

I was doing this:

pts = PyThreadState_Swap(NULL);
PyThreadState_Clear(pts);
PyThreadState_Delete(pts);
PyEval_ReleaseLock();

and got a crash in PyThreadState_Clear(). If I understand
the current docs correctly, this should be allowed, so (my
conclusion) the docs are wrong.

I had to change the code in this way to avoid the crashes:

pts = PyThreadState_Get();
PyThreadState_Clear(pts);
pts = PyThreadState_Swap(NULL);
PyThreadState_Delete(pts);
PyEval_ReleaseLock();

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-04-17 20:10

Message:
Logged In: YES
user_id=31435

That was a confusing thread, and this is a confusing bug
report <wink>.

Are you claiming that the GIL does not need to be held? If
not (and it doesn't seem that you were in the thread), it's
unclear why you mention the GIL.

Best would be if you attached a patch incorporating what you
think the resolution of that thread was.



----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=723205&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.