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

Fix to allow installation with Python 3.8 #1340

Merged
merged 8 commits into from
Nov 24, 2019
9 changes: 8 additions & 1 deletion pynest/nest/import_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import ast
import os
import sys


# We search through the subdirectory "lib" of the "nest" module
Expand Down Expand Up @@ -68,7 +69,13 @@ def import_libs(mod_file, mod_dict, path,
# construct from .pkg_name import *
names = [ast.alias(name='*', asname=None)]
body = [ast.ImportFrom(module=pkg_name, names=names, level=level)]
module = ast.fix_missing_locations(ast.Module(body=body))

# changes in python 3.8
# see https://bugs.python.org/issue35894
if sys.version_info >= (3, 8):
module = ast.fix_missing_locations(ast.Module(body=body, type_ignores=[]))
else:
module = ast.fix_missing_locations(ast.Module(body=body))

code = compile(module, mod_file, 'exec')
exec(code, mod_dict, mod_dict)
4 changes: 2 additions & 2 deletions pynest/nest/tests/test_sp/test_growth_curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import unittest
import nest
import time
import sys

HAVE_OPENMP = nest.ll_api.sli_func("is_threaded")


Expand Down Expand Up @@ -306,15 +308,13 @@ def simulate(self):
self.se_python = numpy.zeros(
(len(self.se_integrator), len(self.sim_steps)))

start = time.clock()
for t_i, t in enumerate(self.sim_steps):
for n_i, n in enumerate(self.local_nodes):
self.ca_nest[n_i][t_i], synaptic_elements = nest.GetStatus(
[n], ('Ca', 'synaptic_elements'))[0]
self.se_nest[n_i][t_i] = synaptic_elements['se']['z']
nest.Simulate(self.sim_step)

start = time.clock()
tmp = nest.GetStatus(self.spike_detector, 'events')[0]
spikes_all = tmp['times']
senders_all = tmp['senders']
Expand Down