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

Some PROP_PY_INDEX dependent fragments need #if USE_PYTHON wrapper. #772

Merged
merged 2 commits into from
Oct 12, 2020
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
4 changes: 4 additions & 0 deletions src/nrnoc/cabcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ Section* nrnpy_newsection(void* v) {
Item* itm;
Section* sec;
sec = new_section((Object*)0, (Symbol*)0, 0);
#if USE_PYTHON
sec->prop->dparam[PROP_PY_INDEX]._pvoid = v;
#endif
itm = lappendsec(section_list, sec);
sec->prop->dparam[8].itm = itm;
return sec;
Expand All @@ -318,6 +320,7 @@ void delete_section(void) {
hoc_retpushx(0.0);
return;
}
#if USE_PYTHON
if (sec->prop->dparam[PROP_PY_INDEX]._pvoid) { /* Python Section */
/* the Python Section will be a zombie section with a pointer
to an invalid Section*.
Expand All @@ -328,6 +331,7 @@ void delete_section(void) {
hoc_retpushx(0.0);
return;
}
#endif
if (!sec->prop->dparam[0].sym) {
hoc_execerror("Cannot delete an unnamed hoc section", (char*)0);
}
Expand Down
4 changes: 4 additions & 0 deletions src/nrnoc/secref.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ static double s_unname(void* v) {
hoc_Item** pitm;
Section* sec;
sec = (Section*)v;
#if USE_PYTHON
/* Python Sections cannot be unnamed, return 0.0 */
if (sec->prop && sec->prop->dparam[PROP_PY_INDEX]._pvoid) {
return 0.0;
}
#endif
pitm = sec2pitm(sec);
*pitm = (hoc_Item*)0;
sec->prop->dparam[0].sym = (Symbol*)0;
Expand All @@ -97,10 +99,12 @@ static double s_rename(void* v) {
Printf("SectionRef[???].sec is a deleted section\n");
return 0.;
}
#if USE_PYTHON
/* Python Sections cannot be renamed, return 0.0 */
if (sec->prop->dparam[PROP_PY_INDEX]._pvoid) {
return 0.;
}
#endif
qsec = sec->prop->dparam[8].itm;
if (sec->prop->dparam[0].sym) {
Printf("%s must first be unnamed\n", secname(sec));
Expand Down