Visitar URL original
bpo-36927: Improve the docstring and Doc of traceback. by mangrisano · Pull Request #13359 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260216040950/https://github.com/python/cpython/pull/13359
Skip to content
/ cpython Public

bpo-36927: Improve the docstring and Doc of traceback.#13359

Closed
mangrisano wants to merge 2 commits intopython:mainfrom
mangrisano:fix-issue-36927
Closed

bpo-36927: Improve the docstring and Doc of traceback.#13359
mangrisano wants to merge 2 commits intopython:mainfrom
mangrisano:fix-issue-36927

Conversation

@mangrisano
Copy link
Contributor

@mangrisano mangrisano commented May 16, 2019 •

The request of the issue-36927 regards of making more verbiage the docstring of traceback.format_tb() because actually isn't clear which values the function returns.

After some reviews, It has been decided to improve other methods' docstring and Doc as well.
The methods updated:

  • print_last()
  • print_exc()
  • format_tb()
  • format_stack()

https://bugs.python.org/issue36927

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019

I'm not a core-dev, but it looks like you have many intermediate commits that are unrelated and don't appear in the final diff.

You may want to consider an interactive rebase or a cherry-pick ?

@mangrisano
Copy link
Contributor Author

mangrisano commented May 16, 2019 •

You're right. I'm trying to figure out how to fix it.

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019

git rebase -i origin/master
... delete all the commits you don't want (dd in vim)
... esc :wq # to save and quit
git push # maybe with --force

xx

@mangrisano
Copy link
Contributor Author

mangrisano commented May 16, 2019 •

Is it ok now?

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019

You did force-push, but you don't appear to have removed the intermediate commits.

@mangrisano
Copy link
Contributor Author

If I run git rebase -i origin/master in my local branch, I have only the last commit, the good one. What am I suppose to do? Thank you for your support.

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019

Hum that is weird.

what about git rebase -i bfba8c373e362d48d4ee0e0cf55b8d9c169344ae ?

@mangrisano
Copy link
Contributor Author

With your last command I had the same your output with all the commits that I have to remove. I removed them, I pushed and I think nothing is changed :D Do you confirm that?

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019

Fine now, I only see one commit on github. Maybe the UI took some time to react and your first try worked:-)

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019

Good job ! Rebase are not easy in git !

@mangrisano
Copy link
Contributor Author

mangrisano commented May 16, 2019 •

Good job to you. I've just followed your suggestions to fix it.
Now I have a question: Do I need to do a rebase and remove unnecessary commits everytime I push something?

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019 •

Do I need to do a rebase and remove unnecessary commits everytime I push something?

Not always; it is a question of keeping history clean from unrelated changes, also depends on the projects. Here you had a small change and it had something like ~16 commits including many merges.

Before you rebase the history was looking like so (trimming down the commit descriptions):

* 3906e54b52 (HEAD, origin/pr/13359) Update the docstring of traceback.format_tb() function
*   3c9eb15eb6 Merge branch 'master' of https://github.com/mangrisano/cpython
|\
| * 4a919297d0 Remove _config.yml
| *   9d0c78f1aa Merge branch 'master' of https://github.com/mangrisano/cpython
| |\
| | *   125278d038 Merge branch 'master' of https://github.com/mangrisano/cpython
| | |\
| | | *   a0c7d7ae4c Merge branch 'master' of https://github.com/mangrisano/cpython
| | | |\
| | | | *   a2e57a412e Merge branch 'master' of https://github.com/mangrisano/cpython
| | | | |\
| | | | | *   2cb757f795 Merge branch 'master' of https://github.com/mangrisano/cpython
| | | | | |\
| | | | | | * 671a258845 Set theme jekyll-theme-hacker
| | | | | * | ee138b9c60 Set theme jekyll-theme-hacker
| | | | * | | 2d31dcd8d3 Set theme jekyll-theme-hacker
| | | * | | | 86f1df8917 Set theme jekyll-theme-hacker
| | * | | | | 81654a8472 Set theme jekyll-theme-hacker
| * | | | | | 1b2dd326de Set theme jekyll-theme-hacker
| |/ / / / /
* | | | | | 836b366a53 Remove _config.yml
* | | | | | ec56a762ee Set theme jekyll-theme-hacker
|/ / / / /
* | | | | bfba8c373e [bpo-36748](https://bugs.python.org/issue36748): optimize TextIOWrapper.write() for ASCII string (GH-13002)

and now

* commit 5a087031bad323a3c8a8bffbac2ae8052c47ea6a (HEAD, origin/pr/13359)
| Author: Michele Angrisano <michele.angrisano@gmail.com>
| Date:   Thu May 16 20:49:12 2019 +0200
|
|     Update the docstring of traceback.format_tb() function
|
* commit bfba8c373e362d48d4ee0e0cf55b8d9c169344ae
| Author: Inada Naoki <songofacandy@gmail.com>
| Date:   Thu May 16 15:03:20 2019 +0900
|
|     [bpo-36748](https://bugs.python.org/issue36748): optimize TextIOWrapper.write() for ASCII string (GH-13002)
|

Looks nicer right ?

@mangrisano
Copy link
Contributor Author

Now looks great. Thank you.
PS: Which command did your run to obtain that output? git log?

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019

git log --graph, and the first one with the extra --oneline option

@mangrisano
Copy link
Contributor Author

If I run git log --graph in the branch I obtain the same your last output. If I run it in the master, I obtain the first one, with all that useless commits. This suggests to me that the next time I will have the same problem, isn't it?

@Carreau
Copy link
Contributor

Carreau commented May 16, 2019

You might; it depends on how you work. Usually to submit a patch I'll create a branch, reset --hard origin/master, and work from there.

reset --hard is a bit dangerous as it is one of the rare operation in git that can't be undone – or at least relatively difficult to undo. Anyway do not worry about that for now; it will make sens at some point.

@mangrisano
Copy link
Contributor Author

Ok. Thanks a lot again for supporting me step by step. I've really appreciated it.

@mangrisano mangrisano changed the title bpo-36927: Update the docstring of the traceback.format_tb() function. bpo-36927: Improve the docstring of the traceback.format_tb() function. May 17, 2019
@ezio-melotti
Copy link
Member

I think it would be better to explain what the function does first, then mention the equivalent snippet.
There are also 3 other function with an unhelpful documentation like format_tb(): format_stack,print_exc, print_last. I think those should be fixed as well.

* The methods updated:
  * print_exc()
  * print_last()
  * format_tb()
  * format_stack()
@mangrisano
Copy link
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

: please review the changes made to this pull request.

@mangrisano mangrisano changed the title bpo-36927: Improve the docstring of the traceback.format_tb() function. bpo-36927: Improve the docstring and Doc of traceback. Jun 23, 2019
@mangrisano
Copy link
Contributor Author

/cc @ezio-melotti

Copy link
Member

@iritkatriel iritkatriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to copy-paste paragraphs of documentation, for the same reasons that we don't copy-paste code. "A is a shorthard for B" is both precise and concise, and sends you straight to where the information you are looking for can be found.

Furthermore, the bpo issue was about docstrings and not the rst file (I think it's a bad idea for the docstrings as well, but even more so for the online documentation, which people might want to read through).

@iritkatriel
Copy link
Member

Closing as there was no followup to my change request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants