This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年05月07日 10:24 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| threading_get_ident.patch | vstinner, 2011年05月24日 10:25 | review | ||
| Messages (10) | |||
|---|---|---|---|
| msg135441 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年05月07日 10:24 | |
I don't know why threading._get_ident() (which is _thread.get_ident()) is private: this function is safe. This function becomes useful with pthread_kill() which will be added by #8407. |
|||
| msg135443 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年05月07日 10:26 | |
I think that threading._get_ident() is more reliable than threading.current_thread().ident because Thread.ident can be None in some cases. |
|||
| msg136086 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年05月16日 13:50 | |
@pitrou: What do you think Antoine? |
|||
| msg136088 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年05月16日 13:56 | |
The threading API changed in Python 3 with the PEP 3108, especially and issue #2875. Extract of the PEP: "thread [done] * People should use 'threading' instead. * Rename 'thread' to _thread. * Deprecate dummy_thread and rename _dummy_thread. * Move thread.get_ident over to threading. * Guido has previously supported the deprecation [13]." The issue was closed by the commit [7fe3a8648ce2], "Issue #2875: Rename thread to _thread and dummy_thread to _dummy_thread." |
|||
| msg136089 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年05月16日 13:59 | |
> I think that threading._get_ident() is more reliable than > threading.current_thread().ident because Thread.ident can be None in > some cases. In which case can it be None? |
|||
| msg136092 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年05月16日 14:12 | |
> In which case can it be None? Oh, I misunderstood threading.py. current_thread().ident cannot be None. During the bootstrap of a thread, Thread._ident is None, but current_thread().ident is not None because current_thread() creates a dummy thread object having the right identifer. This dummy object is destroyed at soon as the Thread object is started (see Thread._bootstrap_inner). current_thread().ident is a little bit "suboptimal" because it gets the identifier of the thread, it reads the corresponding thread object, and then it gets the identifier of the thread object. def current_thread(): ... return _active[_get_ident()] ... |
|||
| msg136647 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年05月23日 14:31 | |
I find it strange that you propose to make a function public and remove its doc :) Is a negative missing in the bug title? |
|||
| msg136731 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年05月24日 10:25 | |
threading_get_ident.patch: make get_ident() public, replace threading._get_ident() by threading.get_ident(). According to this patch, get_ident() function *is* used: it is used by the logging and reprlib modules (and many tests). My patch avoids the usage of the low-level module, _thread_, in logging and reprlib. I adapted signal.pthread_kill() documentation to replace threading.current_thread().ident by threading.get_ident(). |
|||
| msg137328 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年05月30日 21:04 | |
New changeset 5548197d1f22 by Victor Stinner in branch 'default': Close #12028: Make threading._get_ident() public, rename it to http://hg.python.org/cpython/rev/5548197d1f22 |
|||
| msg137333 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年05月30日 21:23 | |
New changeset 6387aa6b496d by Victor Stinner in branch 'default': Issue #12028: fix NEWS entry http://hg.python.org/cpython/rev/6387aa6b496d |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:17 | admin | set | github: 56237 |
| 2011年05月30日 21:23:58 | python-dev | set | messages: + msg137333 |
| 2011年05月30日 21:04:22 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg137328 resolution: fixed stage: resolved |
| 2011年05月24日 10:25:43 | vstinner | set | files:
+ threading_get_ident.patch keywords: + patch messages: + msg136731 |
| 2011年05月23日 14:32:40 | vstinner | set | title: threading._get_ident(): remove it in the doc and make it public -> threading._get_ident(): remove it in the doc or make it public |
| 2011年05月23日 14:31:15 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg136647 |
| 2011年05月17日 02:12:08 | rhettinger | set | nosy:
+ rhettinger |
| 2011年05月16日 14:12:18 | vstinner | set | messages: + msg136092 |
| 2011年05月16日 13:59:01 | pitrou | set | messages: + msg136089 |
| 2011年05月16日 13:56:24 | vstinner | set | nosy:
+ brett.cannon, georg.brandl messages: + msg136088 |
| 2011年05月16日 13:50:13 | vstinner | set | nosy:
+ pitrou messages: + msg136086 |
| 2011年05月07日 10:26:38 | vstinner | set | messages: + msg135443 |
| 2011年05月07日 10:24:44 | vstinner | create | |