Skip to content

Commit

Permalink
cffi: set LC_ALL=C when invoking preprocessor
Browse files Browse the repository at this point in the history
This will hopefully normalize line markers to ASCII and fix #95.

I haven't tested this. But setting LC_ALL=C is good for
determinism anyway.
  • Loading branch information
indygreg committed Jun 13, 2020
1 parent fde84bf commit fbd77d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ Bug Fixes
calls ``distutils.sysconfig.customize_compiler()`` so compiler
customizations (such as honoring the ``CC`` environment variable)
are performed. Patch by @Arfrever. (#103)
* The ``make_cffi.py`` script now sets ``LC_ALL=C`` when invoking
the preprocessor in an attempt to normalize output to ASCII. (#95)

Changes
-------
Expand Down
5 changes: 5 additions & 0 deletions make_cffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ def preprocess(path):

try:
env = dict(os.environ)
# cffi attempts to decode source as ascii. And the preprocessor
# may insert non-ascii for some annotations. So try to force
# ascii output via LC_ALL.
env["LC_ALL"] = "C"

if getattr(compiler, "_paths", None):
env["PATH"] = compiler._paths
process = subprocess.Popen(
Expand Down

0 comments on commit fbd77d2

Please sign in to comment.