diff options
author | 2017-03-23 17:19:13 -0700 | |
---|---|---|
committer | 2017-03-23 17:19:13 -0700 | |
commit | bebcc15bb1f920672edf6f159983367abf4acc94 (patch) | |
tree | e2e79b8601a5866434284127e4a0c1ca3c2ea143 /Exec/Langmuir/python/warpx.py | |
parent | f0e6826e751d61ce2df4a84dc61b3e0bc0248391 (diff) | |
download | WarpX-bebcc15bb1f920672edf6f159983367abf4acc94.tar.gz WarpX-bebcc15bb1f920672edf6f159983367abf4acc94.tar.zst WarpX-bebcc15bb1f920672edf6f159983367abf4acc94.zip |
Prevent the print function from being garbage collected.
Diffstat (limited to 'Exec/Langmuir/python/warpx.py')
-rw-r--r-- | Exec/Langmuir/python/warpx.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Exec/Langmuir/python/warpx.py b/Exec/Langmuir/python/warpx.py index 99aec6ce0..d8b97f202 100644 --- a/Exec/Langmuir/python/warpx.py +++ b/Exec/Langmuir/python/warpx.py @@ -77,8 +77,8 @@ def print_step(i): This function is called by C++. This is just a demo. ''' - print "\nCalling a Python function from C++. Step = ", i -KEEP_ALIVE_FUNC_print_step = print_step # otherwise the function may get garbage collected. + print("\nCalling a Python function from C++. Step = ", i) +c_print_step = CALLBACK_FUNC_1(print_step) def initialize(): ''' @@ -97,7 +97,7 @@ def initialize(): libwarpx.amrex_init(argc, argv) libwarpx.warpx_init() - libwarpx.warpx_set_callback_py_funcs(CALLBACK_FUNC_1(print_step)) + libwarpx.warpx_set_callback_py_funcs(c_print_step) def finalize(): |