classification
Title: dummy_threading lacks threading.get_ident() equivalent
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: berker.peksag Nosy List: berker.peksag, brett.cannon, methane, r.david.murray, vstinner, xtreak, zuo
Priority: normal Keywords: patch

Created on 2013-08-27 21:27 by zuo, last changed 2019-12-31 11:55 by methane. This issue is now closed.

Files
File name Uploaded Description Edit
issue18858.diff berker.peksag, 2016-01-20 13:06 review
issue18858_v2.diff berker.peksag, 2016-07-14 14:49
Messages (6)
msg196321 - (view) Author: Jan Kaliszewski (zuo) Date: 2013-08-27 21:27
In Python 3.3 threading.get_ident() has been added as a public and documented function, but there is no dummy_threading.get_ident():

    >>> import threading, dummy_threading
    >>> threading.get_ident()
    139974728402752
    >>> dummy_threading.get_ident()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'module' object has no attribute 'get_ident'

By the way: it may be worth to check for other possible inconsistencies between avaliable interfaces of threading and dummy_threading.
msg196391 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-08-28 17:37
There should actually be a test to catch the inconsistencies.
msg258680 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-01-20 13:06
dummy_threading.get_ident() works for me:

    >>> import dummy_threading as dt
    >>> dt.get_ident()
    -1
    >>> import threading
    >>> threading.get_ident()
    140498493105920

Here is a patch to compare threading and dummy_threading modules.
msg270105 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-07-10 17:09
A forgotten issue marked commit review.  I guess we aren't checking the commit review queue very carefully; I certainly haven't been :(.

This patch adds a test but does not fix the bug.  The assert should have a message parameter like the existing use of it in the test suite.  Lines should be wrapped at 80...the lack of wrapping in the original import has already been corrected.  Finally, the test seems more appropriate in test_dummythreading than test_threading.
msg270414 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-07-14 14:49
> This patch adds a test but does not fix the bug.

I forgot to explain what the first patch does. The specific problem reported by OP has already been fixed in default branch (but not in 3.5) so issue18858.diff was added a test to make sure that threading and dummy_threading API are in sync.

dummy_threading.currentThread() and dummy_threading.activeCount() still don't work in both 3.5 and default branches so we basically need two different patches. I'm attaching a patch for 3.5.
msg359112 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-12-31 11:08
dummy_threading was removed in Python 3.9 with issue37312 . I hope this issue can be closed as outdated.
History
Date User Action Args
2019-12-31 11:55:47methanesetstatus: open -> closed
resolution: wont fix
stage: patch review -> resolved
2019-12-31 11:08:14xtreaksetnosy: + xtreak, methane
messages: + msg359112
2016-07-14 14:49:37berker.peksagsetfiles: + issue18858_v2.diff

messages: + msg270414
stage: needs patch -> patch review
2016-07-10 17:09:06r.david.murraysetnosy: + r.david.murray

messages: + msg270105
stage: commit review -> needs patch
2016-01-20 17:40:17brett.cannonsetassignee: berker.peksag
stage: patch review -> commit review
2016-01-20 13:06:04berker.peksagsetfiles: + issue18858.diff

versions: + Python 3.5, Python 3.6, - Python 3.3, Python 3.4
keywords: + patch
nosy: + berker.peksag

messages: + msg258680
stage: test needed -> patch review
2013-08-31 00:25:50vstinnersetnosy: + vstinner
2013-08-28 17:37:31brett.cannonsetnosy: + brett.cannon

messages: + msg196391
stage: test needed
2013-08-27 21:27:23zuocreate