Skip to content

Fix crash since os.environ can't be pickled#23

Merged
dirk-thomas merged 1 commit intocolcon:dirk-thomas/improve-python-package-informationfrom
RoverRobotics-forks:dirk-thomas/improve-python-package-information
Oct 23, 2019
Merged

Fix crash since os.environ can't be pickled#23
dirk-thomas merged 1 commit intocolcon:dirk-thomas/improve-python-package-informationfrom
RoverRobotics-forks:dirk-thomas/improve-python-package-information

Conversation

@rotu
Copy link
Copy Markdown
Contributor

@rotu rotu commented Oct 23, 2019

No description provided.

@dirk-thomas
Copy link
Copy Markdown
Member

Can you please add description why os.environ can't be pickled but a copy can be? Also a note about this above that line would be helpful to clarify why the .copy() is there.

@rotu rotu force-pushed the dirk-thomas/improve-python-package-information branch from 1170c23 to 1c343a7 Compare October 23, 2019 03:00
@rotu
Copy link
Copy Markdown
Contributor Author

rotu commented Oct 23, 2019

good call - I wasn't clear. I moved it, switched to the dict() constructor, and spelled it out a bit better.

@rotu
Copy link
Copy Markdown
Contributor Author

rotu commented Oct 23, 2019

CI error is because line length. I'd add a type annotation instead of a comment, but maybe you don't like them.


:param Path setup_py: path to a setup.py script
:param dict env: environment variables to set before running setup.py
:param Mapping[str, str] env: environment variables to set before running setup.py
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.

I don't think Mapping is a defined type in this context at the moment. Should it be collections.abc.Mapping?

Are there any cases where this is called with a dict?

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.

typing.Mapping[str, str]. If you try to use collections.abc, you'll get an error.
I don't know if there are cases now, but you want to allow a dict, so that it can be modified before passing. Changing os.environ is probably not a good idea.

@dirk-thomas
Copy link
Copy Markdown
Member

CI error is because line length.

That should be straight forward by wrapping some part of the line to the next line.

I'd add a type annotation instead of a comment, but maybe you don't like them.

Currently most of the API doesn't use it (since only newer Python version support more complete type annotations). As long as it is compatible with Python 3.5 I am fine with adding it.

@rotu rotu force-pushed the dirk-thomas/improve-python-package-information branch from 1c343a7 to 40fd670 Compare October 23, 2019 03:24
@dirk-thomas
Copy link
Copy Markdown
Member

Thanks for the patch.

@dirk-thomas dirk-thomas merged commit 7c8df83 into colcon:dirk-thomas/improve-python-package-information Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants