A patch for gdbmmodule

Damjan arhiv at freemail.org.mk
Fri Dec 8 13:30:47 EST 2000


Hi everybody. According the info page for gdbm:
...
The option GDBM_FAST is now
obsolete, since `gdbm' defaults to no-sync mode.
...
So I made some modifications to the gdbmmodule to reflect this, and to allow
opening a database unlocked. The new options to gdbm.open(...) are 's' to open
the db in SYNC mode and 'u' to open the db unlocked. There is also a need to
define lock() and unlock methods to the gdbm object, but I can't find a way to
unlock the gdbm file.

Here's the patch (against a Python2.0 gdbmmodule.c):

*** gdbmmodule.c.old	Mon Dec  4 13:34:59 2000
--- gdbmmodule.c	Mon Dec  4 13:34:15 2000
***************
*** 454,461 ****
                          "Flags should be one of 'r', 'w', 'c' or 'n'");
          return NULL;
      }
!     if (flags[1] == 'f')
!         iflags |= GDBM_FAST;
      return newdbmobject(name, iflags, mode);
  }
  
--- 454,463 ----
                          "Flags should be one of 'r', 'w', 'c' or 'n'");
          return NULL;
      }
! 	if (flags[1] != '\0') {
! 		if (flags[1] == 's' || flags[2] == 's') iflags |= GDBM_SYNC;
! 		if (flags[1] == 'u' || flags[2] == 'u') iflags |= GDBM_NOLOCK;
! 	}
      return newdbmobject(name, iflags, mode);
  }
  


Now, what do you think and whom should I send this patch?
(and please Cc: the reply to me also)

-- 
Damjan Georgievski		|           Дамјан Георгиевски
Skopje, Macedonia		|           Скопје, Македонија




More information about the Python-list mailing list