Skip to content

bpo-5001, bpo-31169: Fix two uninformative asserts in multiprocessing/managers.py#3078

Merged
pitrou merged 4 commits into
python:masterfrom
drallensmith:master
Aug 12, 2017
Merged

bpo-5001, bpo-31169: Fix two uninformative asserts in multiprocessing/managers.py#3078
pitrou merged 4 commits into
python:masterfrom
drallensmith:master

Conversation

@drallensmith

@drallensmith drallensmith commented Aug 12, 2017

Copy link
Copy Markdown
Contributor

There are quite a few uninformative asserts in the multiprocessing code, as discussed in issue5001 and issue31169. One of them that is most potentially problematic is in error-reporting code, in convert_to_error. (I will try to work on some of the other asserts when I have the time, but I am running low on disk space and suspect a clone of the entire cpython repository would be rather large...) For this PR, the identical code is present in 2.7.13 and 3.5.3, and I strongly suspect in all other versions between 2.7 and 3.7.

https://bugs.python.org/issue5001

Replace assertions in error-reporting code with more-informative version that doesn't cause confusion over where and what the error is.
Comment thread Lib/multiprocessing/managers.py Outdated
return RemoteError('Unserializable message: %s\n' % result)
elif kind in ('#TRACEBACK', '#UNSERIALIZABLE'):
if not isinstance(result, str):
raise SystemError(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We usually reserve SystemError for low-level errors inside the interpreter, so I suggest using something else.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah; I had thought it would include low-level inside standard library files, if it was something that did not appear likely to be from a user mistake. Thanks; changing to TypeError, unless there is a better one.

@pitrou

pitrou commented Aug 12, 2017

Copy link
Copy Markdown
Member

Thanks for the PR. Apart from the comment I added, it also needs a NEWS entry as added with the "blurb" utility.

As suggested in PR comment by @pitrou, changing from SystemError; TypeError appears appropriate.
@drallensmith

Copy link
Copy Markdown
Contributor Author

@pitrou - would it work to do a --depth 3 git clone of my fork so I can use "blurb" locally? Thanks!

@drallensmith

Copy link
Copy Markdown
Contributor Author

Quite welcome, BTW.

@pitrou

pitrou commented Aug 12, 2017

Copy link
Copy Markdown
Member

@pitrou - would it work to do a --depth 3 git clone of my fork so I can use "blurb" locally?

Probably? I don't use a separate clone for "blurb" myself, so I'm not sure why you would need one.

@drallensmith

Copy link
Copy Markdown
Contributor Author

@pitrou - I currently don't have a local clone of cpython due to disk space issues; I am thinking I could manage a shallow clone of my fork, which would also enable me to (long-term) work on some of the other asserts, expand the code change to other dev versions, etc.

@pitrou

pitrou commented Aug 12, 2017

Copy link
Copy Markdown
Member

Yes, a shallow clone would probably work, at least I don't see a reason against it.

@drallensmith

Copy link
Copy Markdown
Contributor Author

NEWS file added as per helpful instruction from @pitrou - also ACKS, although not sure if I've really justified it yet... will work on doing so.

@pitrou

pitrou commented Aug 12, 2017

Copy link
Copy Markdown
Member

Any contributor deserves to be in Misc/ACKS, no worries here :-)

@pitrou
pitrou merged commit 48d9823 into python:master Aug 12, 2017
@pitrou

pitrou commented Aug 12, 2017

Copy link
Copy Markdown
Member

Thank you for contributing this @drallensmith !

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants