Fix escaping issue in ansiballz wrapper for sitecustomize (#86236)

* Fix escaping issue in ansiballz wrapper for sitecustomize

* add clog frag
This commit is contained in:
sivel / Matt Martz 2025-11-24 11:33:45 -06:00 committed by GitHub
parent bff3a9aeb9
commit 6bb7bd760f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- modules - fix AnsiballZ wrapper code escaping of sitecustomize

View file

@ -121,7 +121,7 @@ def _ansiballz_main(
z = zipfile.ZipFile(modlib_path, mode='a')
# py3: modlib_path will be text, py2: it's bytes. Need bytes at the end
sitecustomize = u'import sys\\nsys.path.insert(0,"%s")\\n' % modlib_path
sitecustomize = 'import sys\nsys.path.insert(0, "%s")\n' % modlib_path
sitecustomize = sitecustomize.encode('utf-8')
# Use a ZipInfo to work around zipfile limitation on hosts with
# clocks set to a pre-1980 year (for instance, Raspberry Pi)