Commit 7b3ca9e6 authored by Jeremy Hylton's avatar Jeremy Hylton

Remove many unused default argument definitions used as speed optimizations.

Many methods had default arguments that were used to bind a global or
builtin name, like type, None, or type(''), as a local name.  In many
cases, the names bound were not referenced in the method body
(presumably they used to be referenced).

commit_sub(): In this one case, delete the default arg anyway, because
    it's only used once.
parent bb3bc4b7
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
"""Database connection support """Database connection support
$Id: Connection.py,v 1.55 2001/05/22 20:57:03 jeremy Exp $""" $Id: Connection.py,v 1.56 2001/05/22 23:21:22 jeremy Exp $"""
__version__='$Revision: 1.55 $'[11:-2] __version__='$Revision: 1.56 $'[11:-2]
from cPickleCache import PickleCache from cPickleCache import PickleCache
from POSException import ConflictError, ExportError from POSException import ConflictError, ExportError
...@@ -152,7 +152,7 @@ class Connection(ExportImport.ExportImport): ...@@ -152,7 +152,7 @@ class Connection(ExportImport.ExportImport):
except: pass except: pass
def __getitem__(self, oid, def __getitem__(self, oid,
tt=type(()), ct=type(HelperClass)): tt=type(())):
cache=self._cache cache=self._cache
if cache.has_key(oid): return cache[oid] if cache.has_key(oid): return cache[oid]
...@@ -193,8 +193,7 @@ class Connection(ExportImport.ExportImport): ...@@ -193,8 +193,7 @@ class Connection(ExportImport.ExportImport):
return object return object
def _persistent_load(self,oid, def _persistent_load(self,oid,
d={'__builtins__':{}}, tt=type(())):
tt=type(()), st=type(''), ct=type(HelperClass)):
__traceback_info__=oid __traceback_info__=oid
...@@ -300,7 +299,7 @@ class Connection(ExportImport.ExportImport): ...@@ -300,7 +299,7 @@ class Connection(ExportImport.ExportImport):
self.__onCommitActions.append((method_name, args, kw)) self.__onCommitActions.append((method_name, args, kw))
get_transaction().register(self) get_transaction().register(self)
def commit(self, object, transaction, _type=type, _st=type('')): def commit(self, object, transaction):
if object is self: if object is self:
# We registered ourself. Execute a commit action, if any. # We registered ourself. Execute a commit action, if any.
if self.__onCommitActions is not None: if self.__onCommitActions is not None:
...@@ -432,11 +431,10 @@ class Connection(ExportImport.ExportImport): ...@@ -432,11 +431,10 @@ class Connection(ExportImport.ExportImport):
self._handle_serial(s, oid) self._handle_serial(s, oid)
def commit_sub(self, t, def commit_sub(self, t):
_type=type, _st=type(''), _None=None):
"""Commit all work done in subtransactions""" """Commit all work done in subtransactions"""
tmp=self._tmp tmp=self._tmp
if tmp is _None: return if tmp is None: return
src=self._storage src=self._storage
LOG('ZODB', BLATHER, LOG('ZODB', BLATHER,
...@@ -514,7 +512,7 @@ class Connection(ExportImport.ExportImport): ...@@ -514,7 +512,7 @@ class Connection(ExportImport.ExportImport):
def root(self): return self['\0\0\0\0\0\0\0\0'] def root(self): return self['\0\0\0\0\0\0\0\0']
def setstate(self,object): def setstate(self, object):
try: try:
oid=object._p_oid oid=object._p_oid
...@@ -577,8 +575,7 @@ class Connection(ExportImport.ExportImport): ...@@ -577,8 +575,7 @@ class Connection(ExportImport.ExportImport):
unpickler.load() unpickler.load()
return unpickler.load() return unpickler.load()
def setklassstate(self, object, def setklassstate(self, object):
tt=type(()), ct=type(HelperClass)):
try: try:
oid=object._p_oid oid=object._p_oid
__traceback_info__=oid __traceback_info__=oid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment