no current thread warning

Aahz Maruch aahz at panix.com
Fri Dec 15 21:12:16 CET 2000


In article <t3ks6hg7c7rgae at corp.supernews.com>,
Charles Crain <ccrain at austin.rr.com> wrote:
>
>Near as I can tell, this relates to the statement in the documentation for
>the threading.currentThread() function, which states something to the effect
>of "for threads not created by the threading module, a dummy thread with
>limited capabilities will be created."
>
>A have a couple questions regarding this:
>1.  Exactly how are the capabilities limited?  Are there any gotchas I
>should be on the lookout for?

If you look in threading.py, you'll see this:

# Dummy thread class to represent threads not started here.
# These aren't garbage collected when they die,
# nor can they be waited for.
# Their purpose is to return *something* from currentThread().
# They are marked as daemon threads so we won't wait for them
# when we exit (conform previous semantics).

Essentially, they're kept track of so Python *doesn't* try to do
anything with them.

>2.  Why is the warning printed out unconditionally?  IMHO, it should only be
>printed out if the error is potentially fatal, and/or amounts to an asserion
>failure within the interpreter.  If I interpret the dox correctly, this
>message could at best be considered an informational, and should therefore
>be able to be turned off.  It is only cosmetic, but in considering whether
>to commercially release products we have written in Python, it is an issue.

Again, if you look in threading.py, you'll see that there's an __debug__
test that fails if you do "python -O".  In fact, there are several such
locations within threading.py.
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"It's 106 miles to Chicago.  We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses."  "Hit it."



More information about the Python-list mailing list