kicad-developers team mailing list archive
Mailing list archive
Re: PATCH: fix crash in netlist updater
1. No, it's not needed. At first I didn't find Cast() in BOARD_ITEMS cpp
code so thought it's implemented in descendant classes only and added the
check as safeguard like it was done in DList. But now I found that Cast()
is in swig python extension for BOARD_ITEM so it will always be defined.
See amended patch attached.
2. Yes, it works and it was tested on py3 build. Self reference is passed
implicitly in python.
On Tue, Jun 4, 2019 at 5:24 AM Seth Hillbrand <seth@xxxxxxxxxxxxx> wrote:
> On 2019-06-04 03:09, Andrew Lutsenko wrote:
> > Hi Seth,
> > Another patch that fixes some bugs in scripting and restores previous
> > dlist behavior.
> > Regards,
> > Andrew
> Thanks Andrew! A couple questions:
> - Do we need to check the existence of Cast() for the BOARD_ITEMS?
> - Does the next() method work for python 3? I had thought we needed to
> use the function like:
> item = it.next( it )
> Thanks again for addressing this. Best-
From 1059a80537b15ca3c3fe513f7cb0ae3908b6aa83 Mon Sep 17 00:00:00 2001
From: qu1ck <anlutsenko@xxxxxxxxx>
Date: Mon, 3 Jun 2019 23:49:58 -0700
Subject: [PATCH] Pcbnew scripting fixes
* Remove infinite recursion calls in footprint.i
* Extend DRAWINGS deque iterator to auto cast contained BOARD_ITEMS,
similar to what dlist implementation did.
pcbnew/swig/board.i | 12 ++++++++++++
pcbnew/swig/footprint.i | 3 ---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/pcbnew/swig/board.i b/pcbnew/swig/board.i
index ca6d7b119..c47e86670 100644
@@ -106,6 +106,18 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints)
+%extend std::deque<BOARD_ITEM *>
+ def __iter__(self):
+ it = self.iterator()
+ while True:
+ item = it.next() # throws StopIteration when iterator reached the end.
+ yield item.Cast()
// BOARD_ITEM_CONTAINER's interface functions will be implemented by SWIG
diff --git a/pcbnew/swig/footprint.i b/pcbnew/swig/footprint.i
index 2c3108b17..15b5214aa 100644
@@ -50,9 +50,6 @@
- def Pads(self): return self.Pads()
- def GraphicalItems(self): return self.GraphicalItems()
# return SaveModuleToLibrary(filename,self)