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 2016年04月11日 10:19 by xiang.zhang, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| add_staticmethod_and_classmethod_when_dis.dis_a_class.patch | xiang.zhang, 2016年04月11日 10:19 | review | ||
| add_staticmethod_and_classmethod_when_dis.dis_a_class_v2.patch | xiang.zhang, 2016年04月11日 10:39 | review | ||
| add_staticmethod_and_classmethod_when_dis.dis_a_class_v3.patch | xiang.zhang, 2016年04月11日 15:29 | review | ||
| add_staticmethod_and_classmethod_when_dis.dis_a_class_v4.patch | xiang.zhang, 2016年04月12日 02:54 | review | ||
| add_staticmethod_and_classmethod_when_dis.dis_a_class_v5.patch | xiang.zhang, 2016年04月12日 06:52 | review | ||
| Messages (12) | |||
|---|---|---|---|
| msg263176 - (view) | Author: Xiang Zhang (xiang.zhang) * (Python committer) | Date: 2016年04月11日 10:19 | |
Though the documentation tells when disassembling a class, it disassembles all methods for dis.dis, but staticmethod and classmethod are ignored. I don't know whether this is intended. I write to patch to add staticmethod and classmethod. But unfortunately when I write tests, one unrelated test fails and I cannot figure out why. |
|||
| msg263178 - (view) | Author: Xiang Zhang (xiang.zhang) * (Python committer) | Date: 2016年04月11日 10:39 | |
Though don't know why but simply replace %-4d with %3d in dis_bug708901 can fix the test. I updated the patch so all the tests pass and then I'll spend some time figuring out why. |
|||
| msg263187 - (view) | Author: Xiang Zhang (xiang.zhang) * (Python committer) | Date: 2016年04月11日 15:29 | |
After researching the code, I think changing ' %-4d' to '%3d' in dis_bug708901 is right. Since I added some some lines and the lineno of test_bug708901 has arrived at 100+ and the leading space should not be there. According to the code of dis.dis, the right format string should be '%3d'. Not only test_bug708901, all the other ' %-4d' should be changed to '%3d'. If we add 1000+ lines at the head of the file, then all the ' %-4d' format string will lead to test failures. I update my patch. |
|||
| msg263220 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2016年04月12日 02:20 | |
The code and test changes in the latest patch look good to me. For documentation, I suggest updating https://docs.python.org/3/library/dis.html#dis.dis to: - say "it disassembles all methods (including class and static methods)" when describing how classes are handled. - add a version changed note for 3.6 to say that class and static methods are disassembled in addition to normal instance methods when disassembling a class |
|||
| msg263221 - (view) | Author: Xiang Zhang (xiang.zhang) * (Python committer) | Date: 2016年04月12日 02:54 | |
I update the documentation. Learning from devguide, the change of whatsnew is the committer's work. ;) |
|||
| msg263224 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年04月12日 05:48 | |
If this is new feature, perhaps the docs need the versionchanged directive. Otherwise the patch should be applied to all maintained branches. Added other comments on Rietveld. |
|||
| msg263226 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年04月12日 05:48 | |
New changeset b114a0650c44 by Serhiy Storchaka in branch '3.5': Issue #26733: Fixed formatting line numbers in test_dis. https://hg.python.org/cpython/rev/b114a0650c44 New changeset e0816ce68952 by Serhiy Storchaka in branch 'default': Issue #26733: Fixed formatting line numbers in test_dis. https://hg.python.org/cpython/rev/e0816ce68952 New changeset 16a27e38e9b5 by Serhiy Storchaka in branch '2.7': Issue #26733: Fixed formatting line numbers in test_dis. https://hg.python.org/cpython/rev/16a27e38e9b5 |
|||
| msg263233 - (view) | Author: Xiang Zhang (xiang.zhang) * (Python committer) | Date: 2016年04月12日 06:52 | |
Thanks for your comments Serhiy. I update the patch according to your comments. Actually I don't think this is a new feature. Maybe staticmethod and classmethod are just forgotten. As for separate tests for staticmethod and classmethod, I think they are not needed for this patch since right now we can use dis.dis to disassemble them explicitly. Only when dis.dis a class they are missing. But since there are no tests for them, adding tests for them is good. |
|||
| msg263627 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年04月17日 20:36 | |
LGTM. Nick, do you consider this as a new feature, or as a fix? |
|||
| msg263643 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2016年04月18日 05:29 | |
Looking at the history of the dis module, I'd now class this as a bug fix for 3.5+ - it looks like dis.dis gained the ability to disassemble static and class methods as a side-effect of the removal of bound methods in Python 3 (see https://hg.python.org/cpython/rev/48af6375207e ) but because it was a side effect, the additional changes needed to also handle them when disassembling a class were missed. |
|||
| msg264046 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年04月23日 06:24 | |
New changeset d14ea3964590 by Serhiy Storchaka in branch '3.5': Issue #26733: Disassembling a class now disassembles class and static methods. https://hg.python.org/cpython/rev/d14ea3964590 New changeset f96fec10cf25 by Serhiy Storchaka in branch 'default': Issue #26733: Disassembling a class now disassembles class and static methods. https://hg.python.org/cpython/rev/f96fec10cf25 |
|||
| msg264047 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年04月23日 06:25 | |
Thank you for your contribution Xiang Zhang. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:29 | admin | set | github: 70920 |
| 2016年04月23日 06:25:52 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg264047 stage: commit review -> resolved |
| 2016年04月23日 06:24:55 | python-dev | set | messages: + msg264046 |
| 2016年04月23日 06:15:57 | serhiy.storchaka | set | assignee: serhiy.storchaka stage: patch review -> commit review versions: + Python 3.5 |
| 2016年04月18日 05:29:28 | ncoghlan | set | messages: + msg263643 |
| 2016年04月17日 20:36:33 | serhiy.storchaka | set | messages: + msg263627 |
| 2016年04月12日 06:52:46 | xiang.zhang | set | files:
+ add_staticmethod_and_classmethod_when_dis.dis_a_class_v5.patch messages: + msg263233 |
| 2016年04月12日 05:48:47 | python-dev | set | nosy:
+ python-dev messages: + msg263226 |
| 2016年04月12日 05:48:08 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg263224 |
| 2016年04月12日 02:54:33 | xiang.zhang | set | files:
+ add_staticmethod_and_classmethod_when_dis.dis_a_class_v4.patch messages: + msg263221 |
| 2016年04月12日 02:20:45 | ncoghlan | set | messages: + msg263220 |
| 2016年04月11日 15:29:39 | xiang.zhang | set | files:
+ add_staticmethod_and_classmethod_when_dis.dis_a_class_v3.patch messages: + msg263187 |
| 2016年04月11日 10:58:15 | SilentGhost | set | nosy:
+ ncoghlan, yselivanov stage: patch review |
| 2016年04月11日 10:39:34 | xiang.zhang | set | files:
+ add_staticmethod_and_classmethod_when_dis.dis_a_class_v2.patch messages: + msg263178 |
| 2016年04月11日 10:20:08 | xiang.zhang | set | type: behavior components: + Library (Lib) versions: + Python 3.6 |
| 2016年04月11日 10:19:34 | xiang.zhang | create | |