Fix segfault in Python swig test

This commit is contained in:
fly_fzc 2023-08-24 15:49:13 +08:00
parent 43f922181a
commit a01d96f601
2 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,64 @@
From 8ff4cfd06ce554e9df31a088c9d09f45278c6de4 Mon Sep 17 00:00:00 2001
From: Yasuhito Futatsuki <futatuki@apache.org>
Date: Tue, 20 Sep 2022 12:57:06 +0000
Subject: [PATCH] swig-py: Fix conditionals by SWIG version and by Python
version for proxy code.
We are using different code for proxy object, by Python version and by SWIG
version. The distinguish between Python 2 and Python 3 was done by SWIG
macro "SWIGPYTHON_PY3". However, the macro was dropped since SWIG commit
a343b7e[1], between SWIG 4.0.2 release and upcoming SWIG 4.1.0 release.
As we already dropped support for the combination of SWIG >= 4.0 and Python 2,
we should detect Python 2 only in SWIG < 4.0 case. So we can rely on the macro
only in the case.
* subversion/bindings/swig/include/proxy.swg ():
Reorder the conditionals distinguish SWIG versions and Python versions,
as described above.
Found by: Jitka Plesnikova (jplesnik {_AT_} redhat.com)
Suggested by: Julien Schueller (schueller {_AT_} phimeca.com) [2]
[1] https://github.com/swig/swig/commit/a343b7e254567a64761bc1be7dc55b7b7424ec52
[2] https://github.com/swig/swig/issues/2373#issuecomment-1250997124
git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1904167 13f79535-47bb-0310-9956-ffa450edef68
---
subversion/bindings/swig/include/proxy.swg | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/subversion/bindings/swig/include/proxy.swg b/subversion/bindings/swig/include/proxy.swg
index ac67d434ca..7d2d0dd033 100644
--- a/subversion/bindings/swig/include/proxy.swg
+++ b/subversion/bindings/swig/include/proxy.swg
@@ -66,7 +66,6 @@
fn()
%}
-#if defined(SWIGPYTHON_PY3)
#if SWIG_VERSION >= 0x040000
%pythoncode %{
# -classic and -modern options have been dropped and this variable
@@ -76,7 +75,7 @@
_set_instance_attr = _swig_setattr_nondynamic_instance_variable(object.__setattr__)
%}
-#else
+#elif defined(SWIGPYTHON_PY3)
%pythoncode %{
# SWIG classes generated with -modern do not define this variable
try:
@@ -90,7 +89,6 @@
_set_instance_attr = _swig_setattr_nondynamic_method(object.__setattr__)
%}
-#endif
#else
%pythoncode %{
# SWIG classes generated with -classic do not define this variable,
--
2.27.0

View File

@ -10,7 +10,7 @@
Summary: Subversion, a version control system.
Name: subversion
Version: 1.14.2
Release: 3
Release: 4
License: ASL 2.0
URL: https://subversion.apache.org/
@ -22,6 +22,7 @@ Patch2: subversion-1.14.0-soversion.patch
Patch3: subversion-1.8.0-rubybind.patch
Patch4: subversion-1.8.5-swigplWall.patch
Patch5: backport-swig-rb-Use-Ruby-API-File.exist-instead-of-deprecate.patch
Patch6: backport-swig-py-Fix-conditionals-by-SWIG-version-and-by-Pyth.patch
BuildRequires: autoconf libtool texinfo which swig gettext apr-devel apr-util-devel libserf-devel cyrus-sasl-devel sqlite-devel file-devel utf8proc-devel lz4-devel apr-util-openssl dbus-devel, libsecret-devel httpd-devel
Requires: httpd
@ -315,6 +316,9 @@ make check-javahl
%endif
%changelog
* Thu Aug 24 2023 fuanan <fuanan3@h-partners.com> - 1.14.2-4
- Fix segfault in Python swig test
* Fri Aug 4 2023 zhangruifang <zhangruifang1@h-partners.com> - 1.14.2-3
- Use Ruby API 'File.exist?' instead of deprecated 'File.exists?'