Warn for the threading and thread modules#15
Warn for the threading and thread modules#15nanjekyejoannah wants to merge 1 commit intosoftdevteam:migrationfrom
Conversation
| { | ||
| PyObject *m, *d; | ||
|
|
||
| if (PyErr_WarnPy3k_WithFix("In 3.x, the thread module is removed", |
There was a problem hiding this comment.
Is the threading module compatible with thread? In other words, if I e.g. turn import thread.X into import thread.X will that work? I wonder if we need more fine-grained warnings?
There was a problem hiding this comment.
Yes, good one, that is possible, we can warn both ways. For module, and the method where the warning is more fine grained e.g "thread.get_indent was removed in 3.x: use threading._ge_indent instead"
Also note even if you use the threading module, some methods were renamed to have an underscore e.g threading.get_indent is threading._get_indent there is no way to write code that works on both 2.x and 3.x for like 3 methods
There was a problem hiding this comment.
Is the threading module in Python 2 compatible with Python 3? I'm wondering if we have to do some warnings in pygrate2 and some others in pygrate3?
There was a problem hiding this comment.
Not completely, some methods are named with an underscore in 2.x and yet in 3.x they dont have the underscore.
There was a problem hiding this comment.
3 methods are completely incompatible
There was a problem hiding this comment.
Yes, do we need to forward port too? its as simple as aliasing the incompatible methods
There was a problem hiding this comment.
IMHO, if the user can change things in pygrate2, we shouldn't warn in pygrate3. But if they can't change in pygrate2, we should consider aliases & warnings in pygrate3.
There was a problem hiding this comment.
Should we do that in this PR? [I tend to think so, but I don't have a firm opinion.]
There was a problem hiding this comment.
Onmy radar this morning, I want to handle as part of this PR
16: Warn for specific thread module methods r=ltratt a=nanjekyejoannah Dont merge until #13 and #14 are merged, some helper code cuts across. This replaces #15 Threading module Notes Python 2: ``` >>> from thread import get_ident >>> from threading import get_ident Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name get_ident >>> import threading >>> from threading import _get_ident >>> ``` Python 3: ``` >>> from threading import get_ident >>> from thread import get_ident Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'thread' > ``` **Note:** There is no neutral way of porting Co-authored-by: Joannah Nanjekye <jnanjekye@python.org>
Dont merge until #13 and #14 are merged, some helper code cuts across.
Threading module Notes
Python 2:
Python 3:
Note:
There is no neutral way of porting