I was getting occasional 'deallocating None' aborts when using the new C 
parser. The following patch seems to fix them, although I did not study 
the code enough to see which Py_None values were actually getting 
returned. Surely I am inflating the refcount on None, and I don't know 
if that will cause a problem or overflow.

Anyway, here's the patch, made directly to the .c output since I didn't 
have a way to rebuild the parser:

Index: src/bison/SPARQLParser.c
===================================================================
--- src/bison/SPARQLParser.c    (revision 863)
+++ src/bison/SPARQLParser.c    (working copy)
@@ -1763,6 +1763,7 @@
    /* from SPARQL.bgen, line 96
     * Prolog:
     */
+  Py_INCREF(Py_None);
    yyval = Py_None;
    if (self->verbose) {
      fprintf(stderr, "--Prolog(");
@@ -1989,6 +1990,7 @@
    /* from SPARQL.bgen, line 225
     * VAR_REFERENCES: ASTERISK
     */
+  Py_INCREF(Py_None);
    yyval = Py_None;
    if (self->verbose) {
      fprintf(stderr, "--VAR_REFERENCES(");
@@ -4373,6 +4375,7 @@
    /* from SPARQL.bgen, line 96
     * Prolog:
     */
+  Py_INCREF(Py_None);
    yyval = Py_None;
    if (self->verbose) {
      fprintf(stderr, "--Prolog(");
@@ -4599,6 +4602,7 @@
    /* from SPARQL.bgen, line 225
     * VAR_REFERENCES: ASTERISK
     */
+  Py_INCREF(Py_None);
    yyval = Py_None;
    if (self->verbose) {
      fprintf(stderr, "--VAR_REFERENCES(");
@@ -6964,6 +6968,7 @@
    /* from SPARQL.bgen, line 96
     * Prolog:
     */
+  Py_INCREF(Py_None);
    yyval = Py_None;
    if (self->verbose) {
      fprintf(stderr, "--Prolog(");
@@ -7190,6 +7195,7 @@
    /* from SPARQL.bgen, line 225
     * VAR_REFERENCES: ASTERISK
     */
+  Py_INCREF(Py_None);
    yyval = Py_None;
    if (self->verbose) {
      fprintf(stderr, "--VAR_REFERENCES(");

_______________________________________________
Dev mailing list
[email protected]
http://rdflib.net/mailman/listinfo/dev

Reply via email to