Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:GA
python-sip.2072
0001-Fixed_a_regression_in_the_handling_of_stat...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Fixed_a_regression_in_the_handling_of_static_non-pointer_object_variables.patch of Package python-sip.2072
# HG changeset patch # User Phil Thompson <phil@riverbankcomputing.com> # Date 1434757096 -3600 # Node ID dafbaadea76b3606b208a8e6983941de8d371a44 # Parent 95abaccb67d673db918399186d65cdc9db32648b Fixed a regression in the handling of static non-pointer object variables. diff -r 95abaccb67d6 -r dafbaadea76b sipgen/gencode.c --- a/sipgen/gencode.c Thu Jun 11 16:21:25 2015 +0100 +++ b/sipgen/gencode.c Sat Jun 20 00:38:16 2015 +0100 @@ -4484,7 +4484,7 @@ needsNew = ((atype == class_type || atype == mapped_type) && vd->type.nrderefs == 0 && isConstArg(&vd->type)); key = ((atype == class_type || atype == mapped_type) && vd->type.nrderefs == 0) ? vd->module->next_key-- : 0; - second_arg = (generating_c || key < 0) ? "sipPySelf" : ""; + second_arg = (generating_c || (key < 0 && !isStaticVar(vd))) ? "sipPySelf" : ""; prcode(fp, "\n" @@ -4501,12 +4501,23 @@ "{\n" , vd->fqcname, first_arg, second_arg, last_arg); - if (vd->getcode != NULL || key < 0) + if (vd->getcode != NULL) { prcode(fp, " PyObject *sipPy;\n" ); } + else if (key < 0) + { + if (isStaticVar(vd)) + prcode(fp, +" static PyObject *sipPy = NULL;\n" + ); + else + prcode(fp, +" PyObject *sipPy;\n" + ); + } if (vd->getcode == NULL) { @@ -4529,11 +4540,11 @@ prcode(fp, " %S *sipCpp = reinterpret_cast<%S *>(sipSelf);\n" , classFQCName(vd->ecd), classFQCName(vd->ecd)); - - prcode(fp, -"\n" - ); - } + } + + prcode(fp, +"\n" + ); /* Handle any handwritten getter. */ if (vd->getcode != NULL) @@ -4549,49 +4560,65 @@ return; } - if (needsNew) - { - if (generating_c) - prcode(fp, -" *sipVal = "); - else - prcode(fp, -" sipVal = new %b(", &vd->type); - } - else - { - prcode(fp, -" sipVal = "); - - if ((atype == class_type || atype == mapped_type) && vd->type.nrderefs == 0) - prcode(fp, "&"); - } - - generateVarMember(vd, fp); - - prcode(fp, "%s;\n" -"\n" - , ((needsNew && !generating_c) ? ")" : "")); - - switch (atype) - { - case mapped_type: - case class_type: - { - ifaceFileDef *iff; - - if (atype == mapped_type) - iff = vd->type.u.mtd->iff; - else - iff = vd->type.u.cd->iff; - - if (key < 0) - prcode(fp, + if (key < 0) + { + if (isStaticVar(vd)) + { + prcode(fp, +" if (sipPy)\n" +" {\n" +" Py_INCREF(sipPy);\n" +" return sipPy;\n" +" }\n" +"\n" + ); + } + else + { + prcode(fp, " sipPy = sipGetReference(sipPySelf, %d);\n" " if (sipPy)\n" " return sipPy;\n" "\n" - , key); + , key); + } + } + + if (needsNew) + { + if (generating_c) + prcode(fp, +" *sipVal = "); + else + prcode(fp, +" sipVal = new %b(", &vd->type); + } + else + { + prcode(fp, +" sipVal = "); + + if ((atype == class_type || atype == mapped_type) && vd->type.nrderefs == 0) + prcode(fp, "&"); + } + + generateVarMember(vd, fp); + + prcode(fp, "%s;\n" +"\n" + , ((needsNew && !generating_c) ? ")" : "")); + + switch (atype) + { + case mapped_type: + case class_type: + { + ifaceFileDef *iff; + + if (atype == mapped_type) + iff = vd->type.u.mtd->iff; + else + iff = vd->type.u.cd->iff; prcode(fp, " %s sipConvertFrom%sType(", (key < 0 ? "sipPy =" : "return"), (needsNew ? "New" : "")); @@ -4606,11 +4633,15 @@ if (key < 0) { - prcode(fp, + if (!isStaticVar(vd)) + prcode(fp, " sipKeepReference(sipPySelf, %d, sipPy);\n" + , key); + + prcode(fp, "\n" " return sipPy;\n" - , key); + ); } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor