Skip to content

Commit

Permalink
Use f-string
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed May 8, 2024
1 parent ed0867a commit a335687
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Tests/test_image_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,14 @@ def test_embeddable(self) -> None:
from setuptools.command import build_ext

with open("embed_pil.c", "w", encoding="utf-8") as fh:
home = sys.prefix.replace("\\", "\\\\")
fh.write(
"""
f"""
#include "Python.h"
int main(int argc, char* argv[])
{
char *home = \""""
+ sys.prefix.replace("\\", "\\\\")
+ """\";
{{
char *home = "{home}";
wchar_t *whome = Py_DecodeLocale(home, NULL);
Py_SetPythonHome(whome);
Expand All @@ -432,7 +431,7 @@ def test_embeddable(self) -> None:
PyMem_RawFree(whome);
return 0;
}
}}
"""
)

Expand Down

0 comments on commit a335687

Please sign in to comment.