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

Convert to UTF-8 prior to setting Tkinter path #425

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cpython-unix/patch-tkinter-3.10.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 2a3e65b6c97..b17c5bfd6b1 100644
index 2a3e65b6c97..04f2ab0ea10 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -115,6 +115,7 @@ Copyright (C) 1994 Steen Lumholt.
Expand Down Expand Up @@ -82,7 +82,7 @@ index 2a3e65b6c97..b17c5bfd6b1 100644
str_path = _get_tcl_lib_path();
if (str_path == NULL && PyErr_Occurred()) {
return NULL;
@@ -3628,7 +3674,27 @@ PyInit__tkinter(void)
@@ -3628,7 +3674,32 @@ PyInit__tkinter(void)
PyMem_Free(wcs_path);
}
#else
Expand All @@ -97,6 +97,11 @@ index 2a3e65b6c97..b17c5bfd6b1 100644
+ return NULL;
+ }
+ if (str_path != NULL) {
+ path = PyUnicode_AsUTF8(str_path);
+ if (path == NULL) {
+ Py_DECREF(m);
+ return NULL;
+ }
+ setenv("TCL_LIBRARY", path, 1);
+ set_var = 1;
+ }
Expand Down
9 changes: 7 additions & 2 deletions cpython-unix/patch-tkinter-3.11.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 005036d3ff2..c130ed7b186 100644
index 005036d3ff2..0e64706584a 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -28,9 +28,7 @@ Copyright (C) 1994 Steen Lumholt.
Expand Down Expand Up @@ -93,7 +93,7 @@ index 005036d3ff2..c130ed7b186 100644
str_path = _get_tcl_lib_path();
if (str_path == NULL && PyErr_Occurred()) {
return NULL;
@@ -3428,7 +3472,27 @@ PyInit__tkinter(void)
@@ -3428,7 +3472,32 @@ PyInit__tkinter(void)
PyMem_Free(wcs_path);
}
#else
Expand All @@ -108,6 +108,11 @@ index 005036d3ff2..c130ed7b186 100644
+ return NULL;
+ }
+ if (str_path != NULL) {
+ path = PyUnicode_AsUTF8(str_path);
+ if (path == NULL) {
+ Py_DECREF(m);
+ return NULL;
+ }
+ setenv("TCL_LIBRARY", path, 1);
+ set_var = 1;
+ }
Expand Down
9 changes: 7 additions & 2 deletions cpython-unix/patch-tkinter-3.12.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 6b5fcb8a365..99d44ccf1d8 100644
index 6b5fcb8a365..7b196f40166 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -28,9 +28,7 @@ Copyright (C) 1994 Steen Lumholt.
Expand Down Expand Up @@ -93,7 +93,7 @@ index 6b5fcb8a365..99d44ccf1d8 100644
str_path = _get_tcl_lib_path();
if (str_path == NULL && PyErr_Occurred()) {
return NULL;
@@ -3542,7 +3586,27 @@ PyInit__tkinter(void)
@@ -3542,7 +3586,32 @@ PyInit__tkinter(void)
PyMem_Free(wcs_path);
}
#else
Expand All @@ -108,6 +108,11 @@ index 6b5fcb8a365..99d44ccf1d8 100644
+ return NULL;
+ }
+ if (str_path != NULL) {
+ path = PyUnicode_AsUTF8(str_path);
+ if (path == NULL) {
+ Py_DECREF(m);
+ return NULL;
+ }
+ setenv("TCL_LIBRARY", path, 1);
+ set_var = 1;
+ }
Expand Down
12 changes: 7 additions & 5 deletions cpython-unix/patch-tkinter-3.13.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 45897817a56..671b3dfc3d0 100644
index 45897817a56..5633187730a 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -26,9 +26,8 @@ Copyright (C) 1994 Steen Lumholt.
Expand Down Expand Up @@ -94,7 +94,7 @@ index 45897817a56..671b3dfc3d0 100644
str_path = _get_tcl_lib_path();
if (str_path == NULL && PyErr_Occurred()) {
return NULL;
@@ -3552,7 +3597,27 @@ PyInit__tkinter(void)
@@ -3552,7 +3597,32 @@ PyInit__tkinter(void)
PyMem_Free(wcs_path);
}
#else
Expand All @@ -109,6 +109,11 @@ index 45897817a56..671b3dfc3d0 100644
+ return NULL;
+ }
+ if (str_path != NULL) {
+ path = PyUnicode_AsUTF8(str_path);
+ if (path == NULL) {
+ Py_DECREF(m);
+ return NULL;
+ }
+ setenv("TCL_LIBRARY", path, 1);
+ set_var = 1;
+ }
Expand All @@ -122,6 +127,3 @@ index 45897817a56..671b3dfc3d0 100644
#endif /* MS_WINDOWS */
}
Py_XDECREF(cexe);
diff --git a/patch-tkinter.patch b/patch-tkinter.patch
new file mode 100644
index 00000000000..e69de29bb2d
9 changes: 7 additions & 2 deletions cpython-unix/patch-tkinter-3.9.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index e153047b778..5dbaf2e3e6e 100644
index e153047b778..02f5d12db1a 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -115,6 +115,7 @@ Copyright (C) 1994 Steen Lumholt.
Expand Down Expand Up @@ -82,7 +82,7 @@ index e153047b778..5dbaf2e3e6e 100644
str_path = _get_tcl_lib_path();
if (str_path == NULL && PyErr_Occurred()) {
return NULL;
@@ -3631,7 +3677,27 @@ PyInit__tkinter(void)
@@ -3631,7 +3677,32 @@ PyInit__tkinter(void)
PyMem_Free(wcs_path);
}
#else
Expand All @@ -97,6 +97,11 @@ index e153047b778..5dbaf2e3e6e 100644
+ return NULL;
+ }
+ if (str_path != NULL) {
+ path = PyUnicode_AsUTF8(str_path);
+ if (path == NULL) {
+ Py_DECREF(m);
+ return NULL;
+ }
+ setenv("TCL_LIBRARY", path, 1);
+ set_var = 1;
+ }
Expand Down
Loading