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 2010年06月03日 11:42 by eric.araujo, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| fix-pydoc-str.translate-3.1.diff | eric.araujo, 2011年05月27日 15:46 | |||
| fix-pydoc-str.translate-3.2.diff | eric.araujo, 2011年06月10日 17:05 | |||
| Messages (11) | |||
|---|---|---|---|
| msg106942 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2010年06月03日 11:42 | |
Inconsistent behavior: pydoc3 str: works pydoc3 str.translate: doesn’t pydoc3 builtins.str: works pydoc3 builtins.str.translate: doesn’t I think pydoc3 str.translate should work. I’ll be able to try to write a patch in some weeks. |
|||
| msg107621 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2010年06月12日 02:00 | |
Note that
>>> help(str.translate)
Help on method_descriptor:
translate(...)
S.translate(table) -> str
Return a copy of the string S, where all characters have been mapped
..
but
>>> help('str.translate')
no Python documentation found for 'str.translate'
|
|||
| msg127829 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年02月03日 22:59 | |
Yep, same bug. Possibly related: #410336 (I have to read it again to make sure). |
|||
| msg137064 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年05月27日 15:46 | |
Turns out the fix is very simple. Please review. |
|||
| msg137073 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2011年05月27日 16:12 | |
The patch looks good. A nit-pick: + if len(parts) > 0: Since *parts* is a list, the above can be replaced with simply "if parts:". Also, it seems to me that the new code may produce an AttributeError when given invalid name, but locate() function is supposed to return None instead. I wouder if it would be possible to reuse the try/except logic ing the "if module" clause and simply do something like if module: object = module else: object = builtins for part in parts[n:]: try: object = getattr(object, part) except AttributeError: return None return object |
|||
| msg137077 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年05月27日 16:23 | |
> Since *parts* is a list, the above can be replaced with simply "if parts:" Heh, I always use implied truth values and one disagreed with Tarek about this, but here if felt more natural to spell out my mind with an explicit > 0 comparison :) > Also, it seems to me that the new code may produce an AttributeError > when given invalid name I didn’t see that, I forgot to test invalid names, since test_pydoc already has some checks. I’ll add tests and see if I can reproduce what you’re hinting at (it would be helpful if you could give examples of invalid names: full dotted names, method names, class names?). > I wouder if it would be possible to reuse the try/except logic ing > the "if module" clause Sure, as long as the tests pass I have no preference about the implementation. BTW, what’s your opinion on the test I added? I use render_doc to test name resolving, do you think I should also test the command-line pydoc in a subprocess or is it okay to have white-box knowledge here? |
|||
| msg137078 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2011年05月27日 16:26 | |
On Fri, May 27, 2011 at 12:23 PM, Éric Araujo <report@bugs.python.org> wrote: > .. I’ll add tests and see if I can reproduce what you’re hinting at (it would be helpful > if you could give examples of invalid names: full dotted names, method names, class names?). I did not try to apply your patch yet, but what I had in mind was misspelled names like "str.transkate". |
|||
| msg138114 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月10日 17:05 | |
I added tests to cover non-existing attributes and updated the code to follow your clever suggestion. |
|||
| msg141388 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年07月29日 15:36 | |
New changeset 68df566cbf92 by Éric Araujo in branch '2.7': Make "pydoc somebuiltin.somemethod" work (#8887) http://hg.python.org/cpython/rev/68df566cbf92 |
|||
| msg141389 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年07月29日 15:38 | |
New changeset f02a8f906342 by Éric Araujo in branch '3.2': Make "pydoc somebuiltin.somemethod" work (#8887) http://hg.python.org/cpython/rev/f02a8f906342 New changeset 91d6cabf77d6 by Éric Araujo in branch 'default': Merge fix for #8887 from 3.2 http://hg.python.org/cpython/rev/91d6cabf77d6 |
|||
| msg141390 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年07月29日 15:39 | |
Thanks again for the useful review. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:01 | admin | set | github: 53133 |
| 2011年08月01日 12:40:53 | r.david.murray | link | issue12674 superseder |
| 2011年07月29日 15:39:32 | eric.araujo | set | status: open -> closed resolution: fixed messages: + msg141390 stage: commit review -> resolved |
| 2011年07月29日 15:38:43 | python-dev | set | messages: + msg141389 |
| 2011年07月29日 15:36:33 | python-dev | set | nosy:
+ python-dev messages: + msg141388 |
| 2011年07月21日 05:27:20 | ezio.melotti | set | stage: patch review -> commit review versions: - Python 3.1 |
| 2011年06月16日 23:00:21 | r.david.murray | set | title: "pydoc str" works but not "pydoc str.translate" -> "pydoc str" works but not "pydoc str.translate" |
| 2011年06月10日 17:05:53 | eric.araujo | set | files:
+ fix-pydoc-str.translate-3.2.diff messages: + msg138114 |
| 2011年05月27日 16:26:21 | belopolsky | set | messages: + msg137078 |
| 2011年05月27日 16:23:01 | eric.araujo | set | messages: + msg137077 |
| 2011年05月27日 16:12:10 | belopolsky | set | messages: + msg137073 |
| 2011年05月27日 15:46:27 | eric.araujo | set | files:
+ fix-pydoc-str.translate-3.1.diff versions: + Python 3.1, Python 2.7, Python 3.3 keywords: + patch, needs review nosy: + ysj.ray messages: + msg137064 stage: patch review |
| 2011年02月03日 22:59:31 | eric.araujo | set | nosy:
belopolsky, ezio.melotti, eric.araujo messages: + msg127829 |
| 2010年11月28日 02:24:03 | eric.araujo | set | assignee: eric.araujo |
| 2010年06月13日 08:02:07 | ezio.melotti | set | nosy:
+ ezio.melotti |
| 2010年06月12日 02:00:00 | belopolsky | set | nosy:
+ belopolsky messages: + msg107621 |
| 2010年06月03日 11:42:52 | eric.araujo | create | |