-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
layers/meta-opentrons: port python recipe
We need this because we need the altered manifest and access to the manifest.json file in the recipe directory is hardcoded in the recipe for some reason.
- Loading branch information
Showing
34 changed files
with
2,380 additions
and
3 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...ons/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
From f0c9dec63d452a7cd1e15ea653f4aced281f021c Mon Sep 17 00:00:00 2001 | ||
From: Paulo Neves <[email protected]> | ||
Date: Tue, 7 Jun 2022 16:16:41 +0200 | ||
Subject: [PATCH 1/1] Avoid shebang overflow on python-config.py | ||
|
||
The whole native path may be too big, leading to shebang | ||
overflow. Let's just use the env shebang. | ||
|
||
Denial reason: [1] | ||
|
||
Upstream-Status: Denied [distribution] | ||
|
||
[1] https://github.com/python/cpython/pull/93760#pullrequestreview-1005365737 | ||
--- | ||
Makefile.pre.in | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/Makefile.pre.in b/Makefile.pre.in | ||
index f0aedb76cb58999427804255da56fa53284d7032..dd88e43114730f7681715777cc76dabb31113176 100644 | ||
--- a/Makefile.pre.in | ||
+++ b/Makefile.pre.in | ||
@@ -1638,6 +1638,8 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh | ||
@ # Substitution happens here, as the completely-expanded BINDIR | ||
@ # is not available in configure | ||
sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py | ||
+ @ # Otherwise we might get huge shebangs with native paths | ||
+ sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' python-config.py | ||
@ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} | ||
LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config | ||
@ # In OpenEmbedded, always use the python version of the script, the shell | ||
-- | ||
2.25.1 | ||
|
25 changes: 25 additions & 0 deletions
25
...s-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 80f872e4573f542d33f91514538755557d566f79 Mon Sep 17 00:00:00 2001 | ||
From: Alexander Kanavin <[email protected]> | ||
Date: Fri, 25 Jan 2019 19:04:13 +0100 | ||
Subject: [PATCH] Do not add /usr/lib/termcap to linker flags to avoid host | ||
contamination | ||
|
||
Upstream-Status: Inappropriate [oe-core specific] | ||
Signed-off-by: Alexander Kanavin <[email protected]> | ||
|
||
--- | ||
setup.py | 1 - | ||
1 file changed, 1 deletion(-) | ||
|
||
diff --git a/setup.py b/setup.py | ||
index 43e807f..11b5cf5 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -1149,7 +1149,6 @@ class PyBuildExt(build_ext): | ||
'termcap'): | ||
readline_libs.append('termcap') | ||
self.add(Extension('readline', ['readline.c'], | ||
- library_dirs=['/usr/lib/termcap'], | ||
extra_link_args=readline_extra_link_args, | ||
libraries=readline_libs)) | ||
else: |
36 changes: 36 additions & 0 deletions
36
...s-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
From 2406432449784243b7590009d42bd0e871253b2e Mon Sep 17 00:00:00 2001 | ||
From: Alexander Kanavin <[email protected]> | ||
Date: Tue, 29 Jan 2019 15:03:01 +0100 | ||
Subject: [PATCH] Do not use the shell version of python-config that was | ||
introduced in 3.4 | ||
|
||
Revert instead to the original python version: it has our tweaks and | ||
outputs directories correctly. | ||
|
||
Upstream-Status: Inappropriate [oe-specific] | ||
Signed-off-by: Alexander Kanavin <[email protected]> | ||
|
||
--- | ||
Makefile.pre.in | 9 +++------ | ||
1 file changed, 3 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/Makefile.pre.in b/Makefile.pre.in | ||
index ee85f35..f0aedb7 100644 | ||
--- a/Makefile.pre.in | ||
+++ b/Makefile.pre.in | ||
@@ -1640,12 +1640,9 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh | ||
sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py | ||
@ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} | ||
LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config | ||
- @ # On Darwin, always use the python version of the script, the shell | ||
- @ # version doesn't use the compiler customizations that are provided | ||
- @ # in python (_osx_support.py). | ||
- @if test `uname -s` = Darwin; then \ | ||
- cp python-config.py python-config; \ | ||
- fi | ||
+ @ # In OpenEmbedded, always use the python version of the script, the shell | ||
+ @ # version is broken in multiple ways, and doesn't return correct directories | ||
+ cp python-config.py python-config | ||
|
||
|
||
# Install the include files |
27 changes: 27 additions & 0 deletions
27
...rons/recipes-devtools/python/python3/0001-Don-t-search-system-for-headers-libraries.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From b6ead2d17ceafed47e598b6f50f3ff669deec5ab Mon Sep 17 00:00:00 2001 | ||
From: Jeremy Puhlman <[email protected]> | ||
Date: Wed, 4 Mar 2020 00:06:42 +0000 | ||
Subject: [PATCH] Don't search system for headers/libraries | ||
|
||
Upstream-Status: Inappropriate [oe-core specific] | ||
Signed-off-by: Jeremy Puhlman <[email protected]> | ||
|
||
--- | ||
setup.py | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/setup.py b/setup.py | ||
index c190002..5ef368d 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -854,8 +854,8 @@ class PyBuildExt(build_ext): | ||
add_dir_to_list(self.compiler.include_dirs, | ||
sysconfig.get_config_var("INCLUDEDIR")) | ||
|
||
- system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] | ||
- system_include_dirs = ['/usr/include'] | ||
+ system_lib_dirs = [] | ||
+ system_include_dirs = [] | ||
# lib_dirs and inc_dirs are used to search for files; | ||
# if a file is found in one of those directories, it can | ||
# be assumed that no additional -I,-L directives are needed. |
47 changes: 47 additions & 0 deletions
47
...s-devtools/python/python3/0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From 86061629f4a179e740a17e53dd2c98ab47af2fe2 Mon Sep 17 00:00:00 2001 | ||
From: Alexander Kanavin <[email protected]> | ||
Date: Thu, 16 Sep 2021 16:35:37 +0200 | ||
Subject: [PATCH] Lib/pty.py: handle stdin I/O errors same way as master I/O | ||
errors | ||
|
||
reading stdin can throw the same I/O errors as reading from master fd does, | ||
e.g. when running under Yocto's test harness: | ||
====================================================================== | ||
ERROR: test_spawn_doesnt_hang (test.test_pty.PtyTest) | ||
---------------------------------------------------------------------- | ||
Traceback (most recent call last): | ||
File "/usr/lib/python3.10/test/test_pty.py", line 316, in test_spawn_doesnt_hang | ||
pty.spawn([sys.executable, '-c', 'print("hi there")']) | ||
File "/usr/lib/python3.10/pty.py", line 181, in spawn | ||
_copy(master_fd, master_read, stdin_read) | ||
File "/usr/lib/python3.10/pty.py", line 157, in _copy | ||
data = stdin_read(STDIN_FILENO) | ||
File "/usr/lib/python3.10/pty.py", line 132, in _read | ||
return os.read(fd, 1024) | ||
OSError: [Errno 5] Input/output error | ||
|
||
So let's treat both channels the same. | ||
|
||
Upstream-Status: Submitted [https://github.com/python/cpython/pull/28388] | ||
Signed-off-by: Alexander Kanavin <[email protected]> | ||
|
||
--- | ||
Lib/pty.py | 5 ++++- | ||
1 file changed, 4 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/Lib/pty.py b/Lib/pty.py | ||
index 8d8ce40..35439c6 100644 | ||
--- a/Lib/pty.py | ||
+++ b/Lib/pty.py | ||
@@ -154,7 +154,10 @@ def _copy(master_fd, master_read=_read, stdin_read=_read): | ||
os.write(STDOUT_FILENO, data) | ||
|
||
if STDIN_FILENO in rfds: | ||
- data = stdin_read(STDIN_FILENO) | ||
+ try: | ||
+ data = stdin_read(STDIN_FILENO) | ||
+ except OSError: | ||
+ data = b"" | ||
if not data: | ||
fds.remove(STDIN_FILENO) | ||
else: |
32 changes: 32 additions & 0 deletions
32
...s-devtools/python/python3/0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From 01d209277e145072e478d8b9acfea3638ee16cdc Mon Sep 17 00:00:00 2001 | ||
From: Alexander Kanavin <[email protected]> | ||
Date: Fri, 10 Sep 2021 12:28:31 +0200 | ||
Subject: [PATCH] Lib/sysconfig.py: use prefix value from build configuration | ||
file | ||
|
||
This allows correctly substituting them for target installs using | ||
native python. | ||
|
||
Upstream-Status: Inappropriate [oe-core cross builds] | ||
Signed-off-by: Alexander Kanavin <[email protected]> | ||
|
||
--- | ||
Lib/sysconfig.py | 5 +++++ | ||
1 file changed, 5 insertions(+) | ||
|
||
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py | ||
index e64bcdc..40c6b3e 100644 | ||
--- a/Lib/sysconfig.py | ||
+++ b/Lib/sysconfig.py | ||
@@ -613,6 +613,11 @@ def get_config_vars(*args): | ||
_init_non_posix(_CONFIG_VARS) | ||
if os.name == 'posix': | ||
_init_posix(_CONFIG_VARS) | ||
+ _CONFIG_VARS['installed_base'] = _CONFIG_VARS['prefix'] | ||
+ _CONFIG_VARS['base'] = _CONFIG_VARS['prefix'] | ||
+ _CONFIG_VARS['installed_platbase'] = _CONFIG_VARS['prefix'] | ||
+ _CONFIG_VARS['platbase'] = _CONFIG_VARS['prefix'] | ||
+ _CONFIG_VARS['platlibdir'] = _CONFIG_VARS['PLATLIBDIR'] | ||
# For backward compatibility, see issue19555 | ||
SO = _CONFIG_VARS.get('EXT_SUFFIX') | ||
if SO is not None: |
65 changes: 65 additions & 0 deletions
65
...trons/recipes-devtools/python/python3/0001-Makefile-do-not-compile-.pyc-in-parallel.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
From c960837b8fd83074bab5148236f3d0595468cea4 Mon Sep 17 00:00:00 2001 | ||
From: Alexander Kanavin <[email protected]> | ||
Date: Thu, 16 Jan 2020 12:34:20 +0100 | ||
Subject: [PATCH] Makefile: do not compile .pyc in parallel | ||
|
||
This was found to lock up builds, break reproducibility, and produce strange file ownership | ||
races. | ||
|
||
The upstream commit introducing the change was: | ||
https://github.com/python/cpython/commit/1a2dd82f56bd813aacc570e172cefe55a8a41504 | ||
|
||
The build lock up issue is reported here: | ||
https://bugs.python.org/issue45945 | ||
|
||
The repro failures are documented here: | ||
https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20211130-yr_o1a8d/packages/diff-html/ | ||
|
||
Upstream-Status: Inappropriate [see issues above] | ||
Signed-off-by: Alexander Kanavin <[email protected]> | ||
|
||
--- | ||
Makefile.pre.in | 12 ++++++------ | ||
1 file changed, 6 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/Makefile.pre.in b/Makefile.pre.in | ||
index edd70d4..5e13ba2 100644 | ||
--- a/Makefile.pre.in | ||
+++ b/Makefile.pre.in | ||
@@ -1601,30 +1601,30 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c | ||
fi | ||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | ||
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ | ||
- -j0 -d $(LIBDEST) -f \ | ||
+ -d $(LIBDEST) -f \ | ||
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ | ||
$(DESTDIR)$(LIBDEST) | ||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | ||
$(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ | ||
- -j0 -d $(LIBDEST) -f \ | ||
+ -d $(LIBDEST) -f \ | ||
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ | ||
$(DESTDIR)$(LIBDEST) | ||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | ||
$(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ | ||
- -j0 -d $(LIBDEST) -f \ | ||
+ -d $(LIBDEST) -f \ | ||
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ | ||
$(DESTDIR)$(LIBDEST) | ||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | ||
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ | ||
- -j0 -d $(LIBDEST)/site-packages -f \ | ||
+ -d $(LIBDEST)/site-packages -f \ | ||
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages | ||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | ||
$(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ | ||
- -j0 -d $(LIBDEST)/site-packages -f \ | ||
+ -d $(LIBDEST)/site-packages -f \ | ||
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages | ||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | ||
$(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ | ||
- -j0 -d $(LIBDEST)/site-packages -f \ | ||
+ -d $(LIBDEST)/site-packages -f \ | ||
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages | ||
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | ||
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt |
26 changes: 26 additions & 0 deletions
26
...s-devtools/python/python3/0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From 9f85089cc3a21d5ff235bb37c6c9758f2b70497d Mon Sep 17 00:00:00 2001 | ||
From: Alexander Kanavin <[email protected]> | ||
Date: Wed, 30 Jan 2019 12:41:04 +0100 | ||
Subject: [PATCH] Makefile.pre: use qemu wrapper when gathering profile data | ||
|
||
Upstream-Status: Inappropriate [oe-core specific] | ||
Signed-off-by: Alexander Kanavin <[email protected]> | ||
|
||
--- | ||
Makefile.pre.in | 3 +-- | ||
1 file changed, 1 insertion(+), 2 deletions(-) | ||
|
||
diff --git a/Makefile.pre.in b/Makefile.pre.in | ||
index f0aedb7..edd70d4 100644 | ||
--- a/Makefile.pre.in | ||
+++ b/Makefile.pre.in | ||
@@ -519,8 +519,7 @@ build_all_generate_profile: | ||
$(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LDFLAGS_NODIST="$(LDFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)" | ||
|
||
run_profile_task: | ||
- @ # FIXME: can't run for a cross build | ||
- $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true | ||
+ ./pgo-wrapper ./python -m test.regrtest --pgo test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_support || true | ||
|
||
build_all_merge_profile: | ||
$(LLVM_PROF_MERGER) |
50 changes: 50 additions & 0 deletions
50
...es-devtools/python/python3/0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From 7171aeee22a0b7ab57cdf3d1ae15530549f8f92a Mon Sep 17 00:00:00 2001 | ||
From: Yi Fan Yu <[email protected]> | ||
Date: Thu, 1 Apr 2021 13:08:37 -0700 | ||
Subject: [PATCH] Skip failing tests due to load variability on YP AB | ||
|
||
Skip these tests until AB-INT is solved. | ||
|
||
[YOCTO #14296] | ||
|
||
Upstream-Status: Inappropriate [OE-Specific] | ||
|
||
Signed-off-by: Yi Fan Yu <[email protected]> | ||
|
||
--- | ||
Lib/test/_test_multiprocessing.py | 2 ++ | ||
Lib/test/test_time.py | 1 + | ||
2 files changed, 3 insertions(+) | ||
|
||
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py | ||
index 3bc5b8f..a6e106d 100644 | ||
--- a/Lib/test/_test_multiprocessing.py | ||
+++ b/Lib/test/_test_multiprocessing.py | ||
@@ -568,6 +568,7 @@ class _TestProcess(BaseTestCase): | ||
|
||
close_queue(q) | ||
|
||
+ @unittest.skip('timing related test, dependent on load') | ||
def test_many_processes(self): | ||
if self.TYPE == 'threads': | ||
self.skipTest('test not appropriate for {}'.format(self.TYPE)) | ||
@@ -4817,6 +4818,7 @@ class TestWait(unittest.TestCase): | ||
sem.release() | ||
time.sleep(period) | ||
|
||
+ @unittest.skip('timing related test, dependent on load') | ||
def test_wait_integer(self): | ||
from multiprocessing.connection import wait | ||
|
||
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py | ||
index 875615a..aebaa8c 100644 | ||
--- a/Lib/test/test_time.py | ||
+++ b/Lib/test/test_time.py | ||
@@ -474,6 +474,7 @@ class TimeTestCase(unittest.TestCase): | ||
def test_perf_counter(self): | ||
time.perf_counter() | ||
|
||
+ @unittest.skip('timing related test, dependent on load') | ||
def test_process_time(self): | ||
# process_time() should not include time spend during a sleep | ||
start = time.process_time() |
33 changes: 33 additions & 0 deletions
33
...trons/recipes-devtools/python/python3/0001-Use-FLAG_REF-always-for-interned-strings.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
From d7217b79a4e125d4fcc1087743171b94d91d1121 Mon Sep 17 00:00:00 2001 | ||
From: Inada Naoki <[email protected]> | ||
Date: Sat, 14 Jul 2018 00:46:11 +0900 | ||
Subject: [PATCH] Use FLAG_REF always for interned strings | ||
|
||
Upstream-Status: Submitted [https://github.com/python/cpython/pull/8226] | ||
Signed-off-by: Joshua Watt <[email protected]> | ||
|
||
--- | ||
Python/marshal.c | 9 +++++++-- | ||
1 file changed, 7 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/Python/marshal.c b/Python/marshal.c | ||
index 4125240..341c9aa 100644 | ||
--- a/Python/marshal.c | ||
+++ b/Python/marshal.c | ||
@@ -298,9 +298,14 @@ w_ref(PyObject *v, char *flag, WFILE *p) | ||
if (p->version < 3 || p->hashtable == NULL) | ||
return 0; /* not writing object references */ | ||
|
||
- /* if it has only one reference, it definitely isn't shared */ | ||
- if (Py_REFCNT(v) == 1) | ||
+ /* If it has only one reference, it definitely isn't shared. | ||
+ * But we use TYPE_REF always for interned string, to PYC file stable | ||
+ * as possible. | ||
+ */ | ||
+ if (Py_REFCNT(v) == 1 && | ||
+ !(PyUnicode_CheckExact(v) && PyUnicode_CHECK_INTERNED(v))) { | ||
return 0; | ||
+ } | ||
|
||
entry = _Py_hashtable_get_entry(p->hashtable, v); | ||
if (entry != NULL) { |
Oops, something went wrong.