Fix need Lvalue for increment and decrement operand

Signed-off-by: cherry530 <xuping33@huawei.com>
This commit is contained in:
cherry530 2022-03-28 10:21:01 +08:00
parent 69f7752edd
commit 6a5d222dd8
2 changed files with 50 additions and 2 deletions

View File

@ -0,0 +1,42 @@
diff --git a/_ruamel_yaml.c b/_ruamel_yaml.c
index c81694a..587853c 100644
--- a/_ruamel_yaml.c
+++ b/_ruamel_yaml.c
@@ -496,6 +496,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
+#if PY_VERSION_HEX >= 0x030900A4
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
+ #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
+#else
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj) =(refcnt)
+ #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj) = (size)
+#endif
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
#else
@@ -23874,9 +23881,9 @@ static void __pyx_tp_dealloc_12_ruamel_yaml_CParser(PyObject *o) {
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
+ __Pyx_SET_REFCNT(o, PyREFCNT(o) + 1);
__pyx_pw_12_ruamel_yaml_7CParser_3__dealloc__(o);
- --Py_REFCNT(o);
+ __Pyx_SET_REFCNT(o, PyREFCNT(o) - 1);
PyErr_Restore(etype, eval, etb);
}
Py_CLEAR(p->stream);
@@ -24047,9 +24054,9 @@ static void __pyx_tp_dealloc_12_ruamel_yaml_CEmitter(PyObject *o) {
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
+ __Pyx_SET_REFCNT(o, PyREFCNT(o) + 1);
__pyx_pw_12_ruamel_yaml_8CEmitter_3__dealloc__(o);
- --Py_REFCNT(o);
+ __Pyx_SET_REFCNT(o, PyREFCNT(o) - 1);
PyErr_Restore(etype, eval, etb);
}
Py_CLEAR(p->stream);

View File

@ -3,12 +3,15 @@
Name: python-%{pname}
Version: 0.1.2
Release: 1
Release: 2
Summary: C version of reader, parser and emitter for ruamel.yaml derived from libyaml
License: MIT
URL: https://bitbucket.org/ruamel/yaml.clib
Source0: %{pypi_source}
#https://github.com/ruamel/yaml.clib/commit/4777d4333f17c16f40
Patch0: Fix-Need-lvalue-for-increment-and-decrement-operand.patch
BuildRequires: gcc libyaml-devel python3-devel python3-setuptools
%description
@ -35,12 +38,15 @@ It is the C based reader/scanner and emitter for ruamel.yaml.
%files -n python3-%{pname}
%license LICENSE
%{python3_sitearch}/_ruamel_yaml.cpython-*
%{python3_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info
%{python3_sitearch}/%{pypi_name}-%{version}-py*.egg-info
%files help
%defattr(-,root,root)
%doc README.rst
%changelog
* Mon Mar 28 2022 xu_ping <xuping33@huawei.com> - 0.1.2-2
- Fix need Lvalue for increment and decrement operand
* Mon Mar 2 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.1.2-1
- Package init