-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
bpo-34098: multiprocessing.Server now uses ExceptionWithTraceback #8254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. When your account is ready, please add a comment in this pull request Thanks again for your contribution, we look forward to reviewing it! |
|
I've signed the CLA and it's been processed already. Can somebody remove the |
|
NEWS entry added, @pablogsal |
|
@gsalgado Thanks! As a general note, please, do not squash/amend the commits as is easier to check individual changes than a big commit when reviewing. The Pull Request will be squashed when merged (squash and merge) so it does not matter that much to preserve commit hygiene in the PR itself (although it helps when reviewing). |
| @@ -0,0 +1,2 @@ | |||
| Embed stringification of remote traceback in local traceback when a method | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use method when formatting classes and such. For example:
Fix warning message when
os.chdir()fails inside
test.support.temp_cwd(). Patch by Chris Jerdonek.
Also, add a colon at the end of the line. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pablogsal done. used double backticks like I've found in other NEWS entries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add "Patch by Guilherme Salgado" at the end. :)
|
I'd forgotten this was still open... Any chance somebody can review it? |
pitrou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Here are some comments about the proposed changes.
Lib/test/_test_multiprocessing.py
Outdated
| self.assertEqual(foo.f(), 'f()') | ||
| self.assertRaises(ValueError, foo.g) | ||
| with self.assertRaises(ValueError) as ctx: | ||
| foo._callmethod('g') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you simply call foo.g here? Is _callmethod doing something special?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember, really, but foo.g() seems to work as well, so I'll change it
| with self.assertRaises(ValueError) as ctx: | ||
| foo._callmethod('g') | ||
| cause = ctx.exception.__cause__ | ||
| self.assertIsInstance(cause, multiprocessing.pool.RemoteTraceback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of testing low-level details, how about something pertaining to the user's experience?
For example you could have:
class FooBar(object):
def f(self):
return 'f()'
def g(self):
raise ValueError # exception raised here
def _h(self):
return '_h()'And then self.assertIn('# exception raised here', str(cause)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, but should I drop the self.assertIsInstance(cause, multiprocessing.pool.RemoteTraceback) check, then?
|
Also, since this PR is a bit old, can you merge/rebase master into it? |
That way we preserve the original traceback Closes: https://bugs.python.org/issue34098
Misc/NEWS.d/next/Library/2018-07-16-11-35-00.bpo-34098.CVjiuZ.rst
Outdated
Show resolved
Hide resolved
Done |
MaxwellDupre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example given:
Ran 3 tests in 0.360s
OK
Ran test_multi*
Ran 345 tests in 183.352s
OK (skipped=32)
Ran 39 tests in 21.005s
OK
Ran 345 tests in 79.499s
OK (skipped=33)
Ran 345 tests in 92.366s
OK (skipped=29)
Looks ok.
|
This PR is stale because it has been open for 30 days with no activity. |
That way we preserve the original traceback, and make debugging easier
Closes: https://bugs.python.org/issue34098
Note to self: use
./python -m unittest -v test.test_multiprocessing_fork.WithManagerTestMyManagerto run the testshttps://bugs.python.org/issue34098