2 Commits 2f21e191e9 ... 983b385c03

Author SHA1 Message Date
  Stefano Cossu 983b385c03 Remove references to lmdb and xxHash sources in setup.py. 1 year ago
  Stefano Cossu fcfe07cea2 Fix str and repr method signatures. 1 year ago
3 changed files with 15 additions and 12 deletions
  1. 10 7
      cpython/py_term.h
  2. 5 2
      include/graph.h
  3. 0 3
      setup.py

+ 10 - 7
cpython/py_term.h

@@ -300,8 +300,9 @@ static PyGetSetDef BNode_getsetters[] = {
 
 
 static PyObject *
-Term_repr (TermObject *term_obj)
+Term_repr (PyObject *self)
 {
+    TermObject *term_obj = (TermObject *)self;
     LSUP_Term *term = term_obj->ob_struct;
     char *term_repr_ptn = "<%s @%p> '%s'";
     char *term_nt;
@@ -309,18 +310,19 @@ Term_repr (TermObject *term_obj)
         PyErr_SetString (PyExc_ValueError, "Error serializing term.");
         return NULL;
     }
+
     char *term_repr = malloc (
             strlen (term_repr_ptn) +
             strlen (term_nt) +
-            strlen (term_obj->tp_name) + 32); // 32 for pointer address + NUL
-    if (UNLIKELY (!term_repr)) return PyErr_NoMemory;
+            strlen (self->ob_type->tp_name) + 32); // 32 for ptr addr + NUL
+    if (UNLIKELY (!term_repr)) return PyErr_NoMemory();
     sprintf (
             term_repr, term_repr_ptn,
-            term_obj->tp_name, term->obj, term_nt);
+            self->ob_type->tp_name, term_obj, term_nt);
 
     PyObject *result = PyUnicode_FromString (term_repr);
     free (term_repr);
-    if (UNLIKELY (!result)) return PyErr_NoMemory;
+    if (UNLIKELY (!result)) return PyErr_NoMemory();
 
     Py_INCREF (result);
     return result;
@@ -328,12 +330,13 @@ Term_repr (TermObject *term_obj)
 
 
 static PyObject *
-Term_str (PyObject *term_obj)
+Term_str (PyObject *self)
 {
+    TermObject *term_obj = (TermObject *)self;
     LSUP_Term *term = term_obj->ob_struct;
 
     PyObject *result = PyUnicode_FromString (term->data);
-    if (UNLIKELY (!result)) return PyErr_NoMemory;
+    if (UNLIKELY (!result)) return PyErr_NoMemory();
 
     Py_INCREF (result);
     return result;

+ 5 - 2
include/graph.h

@@ -169,8 +169,11 @@ LSUP_graph_contains (const LSUP_Graph *gr, const LSUP_Triple *spo);
 
 /** @brief Begin a transaction.
  *
- * If the underlying store supports it, begin a transaction for the given
- * graph. Note that each graph can only have one open transaction at a time.
+ * If the underlying store supports it, begin a transaction.
+ *
+ * Note that the transaction affects all graphs sharing the same store, and it
+ * may be closed using a different graph as long as this is backed by the same
+ * store. Only one transaction may be opened at a time for the store.
  *
  * The transaction must be either committed with #LSUP_graph_commit() or
  * rolled back with #LSUP_graph_abort().

+ 0 - 3
setup.py

@@ -23,9 +23,6 @@ sources = (
     glob(f"{CODEC_DIR}/codec_*.c") +
     glob(f"{CPY_DIR}/*.c") +
     [
-        f"{EXT_DIR}/openldap/libraries/liblmdb/mdb.c",
-        f"{EXT_DIR}/openldap/libraries/liblmdb/midl.c",
-        f"{EXT_DIR}/xxHash/xxhash.c",
         f"{EXT_DIR}/hashmap/hashmap.c",
         f"{EXT_DIR}/tpl/src/tpl.c",
         f"{EXT_DIR}/log/src/log.c",