Skip to content

Commit dcd30ee

Browse files
committed
py: strip the value of PYTHON_ZSTANDARD_IMPORT_POLICY
I managed to tickle introducing whitespace in the value. Let's just strip whitespace so harmless accidents _just work_.
1 parent 1249fc5 commit dcd30ee

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/news.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Version History
1212
This fixes a nogil / multi-threaded compile error. (#201, #275)
1313
* A zstandard commit to fix qsort detection on BSD operating systems
1414
has been backported. (#272)
15+
* The `PYTHON_ZSTANDARD_IMPORT_POLICY` environment variable now has leading
16+
and trailing whitespace stripped. Values like ` cffi` and `cffi ` are
17+
now equivalent to `cffi`.
1518
* The CI jobs for building wheels have been overhauled to always use
1619
`cibuildwheel` and `uv` (where possible). This change should be backwards
1720
compatible. But wheel building for this project has historically been

zstandard/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
# defining a variable and `setup.py` could write the file with whatever
3838
# policy was specified at build time. Until someone needs it, we go with
3939
# the hacky but simple environment variable approach.
40-
_module_policy = os.environ.get("PYTHON_ZSTANDARD_IMPORT_POLICY", "default")
40+
_module_policy = os.environ.get(
41+
"PYTHON_ZSTANDARD_IMPORT_POLICY", "default"
42+
).strip()
4143

4244
if _module_policy == "default":
4345
if platform.python_implementation() in ("CPython",):

0 commit comments

Comments
 (0)