Skip to content
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

FIX: Canonicalize environment dicts to strings in Windows #3267

Merged
merged 2 commits into from
Nov 28, 2020

Conversation

effigies
Copy link
Member

@effigies effigies commented Nov 2, 2020

Summary

Reading through #2509 and CPython's _winapi.c, it looks like we actually want to pass dicts of str, rather than bytes.

        if (! PyUnicode_Check(key) || ! PyUnicode_Check(value)) {
            PyErr_SetString(PyExc_TypeError,
                "environment can only contain strings");
            goto error;
        }

Fixes #2509.

List of changes proposed in this PR (pull-request)

  • Fix canonicalize to str
  • Pass canonicalized env to Popen in version_from_command()

This last is deprecated and shouldn't be getting called, but NiftyReg still uses it, so that's a separate task.

Acknowledgment

  • (Mandatory) I acknowledge that this contribution will be available under the Apache 2 license.

@codecov
Copy link

codecov bot commented Nov 2, 2020

Codecov Report

Merging #3267 (0dbcedd) into master (35b7927) will not change coverage.
The diff coverage is 33.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3267   +/-   ##
=======================================
  Coverage   64.69%   64.69%           
=======================================
  Files         302      302           
  Lines       39837    39837           
  Branches     5286     5286           
=======================================
  Hits        25773    25773           
  Misses      12974    12974           
  Partials     1090     1090           
Flag Coverage Δ
unittests 64.69% <33.33%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
nipype/utils/filemanip.py 71.46% <20.00%> (ø)
nipype/interfaces/base/core.py 84.14% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35b7927...0dbcedd. Read the comment docs.

@effigies effigies force-pushed the fix/canonicalize_env branch from 7d5639e to 3643d60 Compare November 21, 2020 14:05
@effigies effigies added this to the 1.6.0 milestone Nov 21, 2020
@effigies effigies force-pushed the fix/canonicalize_env branch from 3643d60 to 0dbcedd Compare November 23, 2020 16:17
@effigies effigies merged commit f054c29 into nipy:master Nov 28, 2020
@effigies effigies deleted the fix/canonicalize_env branch November 28, 2020 00:43
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.

TypeError: environment can only contain strings
1 participant