Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 2663dee

Browse files
committed
fix(core): import pybookwyrm before running plugins
Fixes test plugins/{missing-find,not-importing-pybookwyrm}.py which recently broke. Triage. Related to #62.
1 parent 8034f29 commit 2663dee

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/core/plugin_handler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ void plugin_handler::load_plugins()
5353
log(log_level::debug, fmt::format("coercing CPython to look for pybookwyrm in {}", options_.library_path));
5454
#endif
5555

56+
/*
57+
* Triage fix for crash in detail::to_py_dict if no loaded plugin imports pybookwyrm.
58+
* TODO: do away with this, and link pybookwyrm instead.
59+
*/
60+
std::ignore = py::module::import("pybookwyrm");
61+
5662
for (auto &path : options_.plugin_paths)
5763
log(log_level::debug, fmt::format("looking for scripts in {}", path.string()));
5864

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# While there exist no reason to not import pybookwyrm, a module
2+
# that doesn't actually call back should still work.
3+
14
def find(wanted, bookwyrm):
25
pass
36

4-
#PASS TypeError: Unregistered type : bookwyrm::core::year_mod
7+
#PASS exiting plugin 'not-importing-pybookwyrm'

0 commit comments

Comments
 (0)