aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/arch_pybindings.h
diff options
context:
space:
mode:
Diffstat (limited to 'ice40/arch_pybindings.h')
-rw-r--r--ice40/arch_pybindings.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/ice40/arch_pybindings.h b/ice40/arch_pybindings.h
index 42fe8a6d..e502905f 100644
--- a/ice40/arch_pybindings.h
+++ b/ice40/arch_pybindings.h
@@ -21,8 +21,9 @@
#define ARCH_PYBINDINGS_H
#ifndef NO_PYTHON
-#include "pybindings.h"
#include "nextpnr.h"
+#include "pybindings.h"
+#include "pywrappers.h"
NEXTPNR_NAMESPACE_BEGIN
@@ -32,7 +33,12 @@ template <> struct string_converter<BelId>
{
BelId from_str(Context *ctx, std::string name) { return ctx->getBelByName(ctx->id(name)); }
- std::string to_str(Context *ctx, BelId id) { return ctx->getBelName(id).str(ctx); }
+ std::string to_str(Context *ctx, BelId id)
+ {
+ if (id == BelId())
+ throw bad_wrap();
+ return ctx->getBelName(id).str(ctx);
+ }
};
template <> struct string_converter<BelType>