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 memory leak, update to new libSBOLc API #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified sbol/_libsbol.so
Binary file not shown.
18 changes: 12 additions & 6 deletions sbol/libsbol.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.40
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
# This file is compatible with both classic and new-style classes.



from sys import version_info
if version_info >= (2,6,0):
Expand Down Expand Up @@ -39,7 +40,7 @@ def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
if (not static) or hasattr(self,name):
if (not static):
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
Expand Down Expand Up @@ -154,6 +155,10 @@ def getCollectionDescription(*args):
return _libsbol.getCollectionDescription(*args)
getCollectionDescription = _libsbol.getCollectionDescription

def writeDocumentToString(*args):
return _libsbol.writeDocumentToString(*args)
writeDocumentToString = _libsbol.writeDocumentToString

def getDNASequence(*args):
return _libsbol.getDNASequence(*args)
getDNASequence = _libsbol.getDNASequence
Expand Down Expand Up @@ -290,9 +295,9 @@ def dnaComponentInCollection(*args):
return _libsbol.dnaComponentInCollection(*args)
dnaComponentInCollection = _libsbol.dnaComponentInCollection

def writeDocument(*args):
return _libsbol.writeDocument(*args)
writeDocument = _libsbol.writeDocument
def writeDocumentToFile(*args):
return _libsbol.writeDocumentToFile(*args)
writeDocumentToFile = _libsbol.writeDocumentToFile

def setDNASequenceNucleotides(*args):
return _libsbol.setDNASequenceNucleotides(*args)
Expand Down Expand Up @@ -381,5 +386,6 @@ def readDocument(*args):
def printDocument(*args):
return _libsbol.printDocument(*args)
printDocument = _libsbol.printDocument
# This file is compatible with both classic and new-style classes.


11 changes: 7 additions & 4 deletions sbol/sbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def __extend__(self, obj_list):

class Document(object):
'Wrapper around a libSBOLc Document'

def __init__(self):
# create document
self.ptr = libsbol.createDocument()
Expand Down Expand Up @@ -176,9 +176,12 @@ def __init__(self):
self._annotations = []
self._components = []
self._collections = []
def __del__(self):
if self.ptr:
libsbol.deleteDocument(self.ptr)

def __str__(self):
return capture_stdout(libsbol.printDocument, self.ptr)
return libsbol.writeDocumentToString(self.ptr)

def read(self, filename):
libsbol.readDocument(self.ptr, filename)
Expand Down Expand Up @@ -217,7 +220,7 @@ def _proxy(self, ptr):

class DNASequence(object):
'Wrapper around a libSBOLc DNASequence'

def __init__(self, doc, uri):
# create the C object
self.ptr = libsbol.createDNASequence(doc.ptr, uri)
Expand Down Expand Up @@ -253,7 +256,7 @@ def nucleotides(self, value):

class SequenceAnnotation(object):
'Wrapper around a libSBOLc SequenceAnnotation'

def __init__(self, doc, uri):
# create the C object
self.ptr = libsbol.createSequenceAnnotation(doc.ptr, uri)
Expand Down