summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-03-17 08:00:19 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-03-17 08:00:19 (GMT)
commitd91085598f5185b267ea51a3f615da9527af2ed2 (patch)
tree80849b9455438e9963a61d7aff3fc3b060213553 /Lib
parentfe55464f393fc002fd0911a4d8dba6694723d408 (diff)
downloadcpython-d91085598f5185b267ea51a3f615da9527af2ed2.zip
cpython-d91085598f5185b267ea51a3f615da9527af2ed2.tar.gz
cpython-d91085598f5185b267ea51a3f615da9527af2ed2.tar.bz2
Remove apply()
Diffstat (limited to 'Lib')
-rw-r--r--Lib/bsddb/dbobj.py158
-rw-r--r--Lib/bsddb/dbshelve.py4
-rw-r--r--Lib/bsddb/test/test_basics.py2
-rw-r--r--Lib/bsddb/test/test_dbobj.py2
-rw-r--r--Lib/bsddb/test/test_join.py4
-rw-r--r--Lib/compiler/transformer.py2
-rw-r--r--Lib/distutils/archive_util.py2
-rw-r--r--Lib/distutils/command/build_ext.py4
-rw-r--r--Lib/distutils/command/build_py.py8
-rw-r--r--Lib/distutils/dir_util.py2
-rw-r--r--Lib/distutils/filelist.py2
-rw-r--r--Lib/distutils/util.py4
-rw-r--r--Lib/idlelib/MultiCall.py2
-rw-r--r--Lib/logging/__init__.py28
-rw-r--r--Lib/logging/config.py2
-rw-r--r--Lib/plat-mac/gensuitemodule.py4
-rw-r--r--Lib/subprocess.py2
-rw-r--r--Lib/test/crashers/infinite_rec_4.py7
-rw-r--r--Lib/test/test_builtin.py26
19 files changed, 116 insertions, 149 deletions
diff --git a/Lib/bsddb/dbobj.py b/Lib/bsddb/dbobj.py
index 5bcf84b..4a75dd2 100644
--- a/Lib/bsddb/dbobj.py
+++ b/Lib/bsddb/dbobj.py
@@ -31,82 +31,82 @@ except ImportError:
class DBEnv:
def __init__(self, *args, **kwargs):
- self._cobj = apply(db.DBEnv, args, kwargs)
+ self._cobj = db.DBEnv(*args, **kwargs)
def close(self, *args, **kwargs):
- return apply(self._cobj.close, args, kwargs)
+ return self._cobj.close(*args, **kwargs)
def open(self, *args, **kwargs):
- return apply(self._cobj.open, args, kwargs)
+ return self._cobj.open(*args, **kwargs)
def remove(self, *args, **kwargs):
- return apply(self._cobj.remove, args, kwargs)
+ return self._cobj.remove(*args, **kwargs)
def set_shm_key(self, *args, **kwargs):
- return apply(self._cobj.set_shm_key, args, kwargs)
+ return self._cobj.set_shm_key(*args, **kwargs)
def set_cachesize(self, *args, **kwargs):
- return apply(self._cobj.set_cachesize, args, kwargs)
+ return self._cobj.set_cachesize(*args, **kwargs)
def set_data_dir(self, *args, **kwargs):
- return apply(self._cobj.set_data_dir, args, kwargs)
+ return self._cobj.set_data_dir(*args, **kwargs)
def set_flags(self, *args, **kwargs):
- return apply(self._cobj.set_flags, args, kwargs)
+ return self._cobj.set_flags(*args, **kwargs)
def set_lg_bsize(self, *args, **kwargs):
- return apply(self._cobj.set_lg_bsize, args, kwargs)
+ return self._cobj.set_lg_bsize(*args, **kwargs)
def set_lg_dir(self, *args, **kwargs):
- return apply(self._cobj.set_lg_dir, args, kwargs)
+ return self._cobj.set_lg_dir(*args, **kwargs)
def set_lg_max(self, *args, **kwargs):
- return apply(self._cobj.set_lg_max, args, kwargs)
+ return self._cobj.set_lg_max(*args, **kwargs)
def set_lk_detect(self, *args, **kwargs):
- return apply(self._cobj.set_lk_detect, args, kwargs)
+ return self._cobj.set_lk_detect(*args, **kwargs)
def set_lk_max(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max, args, kwargs)
+ return self._cobj.set_lk_max(*args, **kwargs)
def set_lk_max_locks(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max_locks, args, kwargs)
+ return self._cobj.set_lk_max_locks(*args, **kwargs)
def set_lk_max_lockers(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max_lockers, args, kwargs)
+ return self._cobj.set_lk_max_lockers(*args, **kwargs)
def set_lk_max_objects(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max_objects, args, kwargs)
+ return self._cobj.set_lk_max_objects(*args, **kwargs)
def set_mp_mmapsize(self, *args, **kwargs):
- return apply(self._cobj.set_mp_mmapsize, args, kwargs)
+ return self._cobj.set_mp_mmapsize(*args, **kwargs)
def set_timeout(self, *args, **kwargs):
- return apply(self._cobj.set_timeout, args, kwargs)
+ return self._cobj.set_timeout(*args, **kwargs)
def set_tmp_dir(self, *args, **kwargs):
- return apply(self._cobj.set_tmp_dir, args, kwargs)
+ return self._cobj.set_tmp_dir(*args, **kwargs)
def txn_begin(self, *args, **kwargs):
- return apply(self._cobj.txn_begin, args, kwargs)
+ return self._cobj.txn_begin(*args, **kwargs)
def txn_checkpoint(self, *args, **kwargs):
- return apply(self._cobj.txn_checkpoint, args, kwargs)
+ return self._cobj.txn_checkpoint(*args, **kwargs)
def txn_stat(self, *args, **kwargs):
- return apply(self._cobj.txn_stat, args, kwargs)
+ return self._cobj.txn_stat(*args, **kwargs)
def set_tx_max(self, *args, **kwargs):
- return apply(self._cobj.set_tx_max, args, kwargs)
+ return self._cobj.set_tx_max(*args, **kwargs)
def set_tx_timestamp(self, *args, **kwargs):
- return apply(self._cobj.set_tx_timestamp, args, kwargs)
+ return self._cobj.set_tx_timestamp(*args, **kwargs)
def lock_detect(self, *args, **kwargs):
- return apply(self._cobj.lock_detect, args, kwargs)
+ return self._cobj.lock_detect(*args, **kwargs)
def lock_get(self, *args, **kwargs):
- return apply(self._cobj.lock_get, args, kwargs)
+ return self._cobj.lock_get(*args, **kwargs)
def lock_id(self, *args, **kwargs):
- return apply(self._cobj.lock_id, args, kwargs)
+ return self._cobj.lock_id(*args, **kwargs)
def lock_put(self, *args, **kwargs):
- return apply(self._cobj.lock_put, args, kwargs)
+ return self._cobj.lock_put(*args, **kwargs)
def lock_stat(self, *args, **kwargs):
- return apply(self._cobj.lock_stat, args, kwargs)
+ return self._cobj.lock_stat(*args, **kwargs)
def log_archive(self, *args, **kwargs):
- return apply(self._cobj.log_archive, args, kwargs)
+ return self._cobj.log_archive(*args, **kwargs)
def set_get_returns_none(self, *args, **kwargs):
- return apply(self._cobj.set_get_returns_none, args, kwargs)
+ return self._cobj.set_get_returns_none(*args, **kwargs)
if db.version() >= (4,1):
def dbremove(self, *args, **kwargs):
- return apply(self._cobj.dbremove, args, kwargs)
+ return self._cobj.dbremove(*args, **kwargs)
def dbrename(self, *args, **kwargs):
- return apply(self._cobj.dbrename, args, kwargs)
+ return self._cobj.dbrename(*args, **kwargs)
def set_encrypt(self, *args, **kwargs):
- return apply(self._cobj.set_encrypt, args, kwargs)
+ return self._cobj.set_encrypt(*args, **kwargs)
class DB(DictMixin):
def __init__(self, dbenv, *args, **kwargs):
# give it the proper DBEnv C object that its expecting
- self._cobj = apply(db.DB, (dbenv._cobj,) + args, kwargs)
+ self._cobj = db.DB(dbenv._cobj, *args, **kwargs)
# TODO are there other dict methods that need to be overridden?
def __len__(self):
@@ -119,92 +119,92 @@ class DB(DictMixin):
del self._cobj[arg]
def append(self, *args, **kwargs):
- return apply(self._cobj.append, args, kwargs)
+ return self._cobj.append(*args, **kwargs)
def associate(self, *args, **kwargs):
- return apply(self._cobj.associate, args, kwargs)
+ return self._cobj.associate(*args, **kwargs)
def close(self, *args, **kwargs):
- return apply(self._cobj.close, args, kwargs)
+ return self._cobj.close(*args, **kwargs)
def consume(self, *args, **kwargs):
- return apply(self._cobj.consume, args, kwargs)
+ return self._cobj.consume(*args, **kwargs)
def consume_wait(self, *args, **kwargs):
- return apply(self._cobj.consume_wait, args, kwargs)
+ return self._cobj.consume_wait(*args, **kwargs)
def cursor(self, *args, **kwargs):
- return apply(self._cobj.cursor, args, kwargs)
+ return self._cobj.cursor(*args, **kwargs)
def delete(self, *args, **kwargs):
- return apply(self._cobj.delete, args, kwargs)
+ return self._cobj.delete(*args, **kwargs)
def fd(self, *args, **kwargs):
- return apply(self._cobj.fd, args, kwargs)
+ return self._cobj.fd(*args, **kwargs)
def get(self, *args, **kwargs):
- return apply(self._cobj.get, args, kwargs)
+ return self._cobj.get(*args, **kwargs)
def pget(self, *args, **kwargs):
- return apply(self._cobj.pget, args, kwargs)
+ return self._cobj.pget(*args, **kwargs)
def get_both(self, *args, **kwargs):
- return apply(self._cobj.get_both, args, kwargs)
+ return self._cobj.get_both(*args, **kwargs)
def get_byteswapped(self, *args, **kwargs):
- return apply(self._cobj.get_byteswapped, args, kwargs)
+ return self._cobj.get_byteswapped(*args, **kwargs)
def get_size(self, *args, **kwargs):
- return apply(self._cobj.get_size, args, kwargs)
+ return self._cobj.get_size(*args, **kwargs)
def get_type(self, *args, **kwargs):
- return apply(self._cobj.get_type, args, kwargs)
+ return self._cobj.get_type(*args, **kwargs)
def join(self, *args, **kwargs):
- return apply(self._cobj.join, args, kwargs)
+ return self._cobj.join(*args, **kwargs)
def key_range(self, *args, **kwargs):
- return apply(self._cobj.key_range, args, kwargs)
+ return self._cobj.key_range(*args, **kwargs)
def has_key(self, *args, **kwargs):
- return apply(self._cobj.has_key, args, kwargs)
+ return self._cobj.has_key(*args, **kwargs)
def items(self, *args, **kwargs):
- return apply(self._cobj.items, args, kwargs)
+ return self._cobj.items(*args, **kwargs)
def keys(self, *args, **kwargs):
- return apply(self._cobj.keys, args, kwargs)
+ return self._cobj.keys(*args, **kwargs)
def open(self, *args, **kwargs):
- return apply(self._cobj.open, args, kwargs)
+ return self._cobj.open(*args, **kwargs)
def put(self, *args, **kwargs):
- return apply(self._cobj.put, args, kwargs)
+ return self._cobj.put(*args, **kwargs)
def remove(self, *args, **kwargs):
- return apply(self._cobj.remove, args, kwargs)
+ return self._cobj.remove(*args, **kwargs)
def rename(self, *args, **kwargs):
- return apply(self._cobj.rename, args, kwargs)
+ return self._cobj.rename(*args, **kwargs)
def set_bt_minkey(self, *args, **kwargs):
- return apply(self._cobj.set_bt_minkey, args, kwargs)
+ return self._cobj.set_bt_minkey(*args, **kwargs)
def set_bt_compare(self, *args, **kwargs):
- return apply(self._cobj.set_bt_compare, args, kwargs)
+ return self._cobj.set_bt_compare(*args, **kwargs)
def set_cachesize(self, *args, **kwargs):
- return apply(self._cobj.set_cachesize, args, kwargs)
+ return self._cobj.set_cachesize(*args, **kwargs)
def set_flags(self, *args, **kwargs):
- return apply(self._cobj.set_flags, args, kwargs)
+ return self._cobj.set_flags(*args, **kwargs)
def set_h_ffactor(self, *args, **kwargs):
- return apply(self._cobj.set_h_ffactor, args, kwargs)
+ return self._cobj.set_h_ffactor(*args, **kwargs)
def set_h_nelem(self, *args, **kwargs):
- return apply(self._cobj.set_h_nelem, args, kwargs)
+ return self._cobj.set_h_nelem(*args, **kwargs)
def set_lorder(self, *args, **kwargs):
- return apply(self._cobj.set_lorder, args, kwargs)
+ return self._cobj.set_lorder(*args, **kwargs)
def set_pagesize(self, *args, **kwargs):
- return apply(self._cobj.set_pagesize, args, kwargs)
+ return self._cobj.set_pagesize(*args, **kwargs)
def set_re_delim(self, *args, **kwargs):
- return apply(self._cobj.set_re_delim, args, kwargs)
+ return self._cobj.set_re_delim(*args, **kwargs)
def set_re_len(self, *args, **kwargs):
- return apply(self._cobj.set_re_len, args, kwargs)
+ return self._cobj.set_re_len(*args, **kwargs)
def set_re_pad(self, *args, **kwargs):
- return apply(self._cobj.set_re_pad, args, kwargs)
+ return self._cobj.set_re_pad(*args, **kwargs)
def set_re_source(self, *args, **kwargs):
- return apply(self._cobj.set_re_source, args, kwargs)
+ return self._cobj.set_re_source(*args, **kwargs)
def set_q_extentsize(self, *args, **kwargs):
- return apply(self._cobj.set_q_extentsize, args, kwargs)
+ return self._cobj.set_q_extentsize(*args, **kwargs)
def stat(self, *args, **kwargs):
- return apply(self._cobj.stat, args, kwargs)
+ return self._cobj.stat(*args, **kwargs)
def sync(self, *args, **kwargs):
- return apply(self._cobj.sync, args, kwargs)
+ return self._cobj.sync(*args, **kwargs)
def type(self, *args, **kwargs):
- return apply(self._cobj.type, args, kwargs)
+ return self._cobj.type(*args, **kwargs)
def upgrade(self, *args, **kwargs):
- return apply(self._cobj.upgrade, args, kwargs)
+ return self._cobj.upgrade(*args, **kwargs)
def values(self, *args, **kwargs):
- return apply(self._cobj.values, args, kwargs)
+ return self._cobj.values(*args, **kwargs)
def verify(self, *args, **kwargs):
- return apply(self._cobj.verify, args, kwargs)
+ return self._cobj.verify(*args, **kwargs)
def set_get_returns_none(self, *args, **kwargs):
- return apply(self._cobj.set_get_returns_none, args, kwargs)
+ return self._cobj.set_get_returns_none(*args, **kwargs)
if db.version() >= (4,1):
def set_encrypt(self, *args, **kwargs):
- return apply(self._cobj.set_encrypt, args, kwargs)
+ return self._cobj.set_encrypt(*args, **kwargs)
diff --git a/Lib/bsddb/dbshelve.py b/Lib/bsddb/dbshelve.py
index d341ab7..5cd4a53 100644
--- a/Lib/bsddb/dbshelve.py
+++ b/Lib/bsddb/dbshelve.py
@@ -169,7 +169,7 @@ class DBShelf(DictMixin):
# given nothing is passed to the extension module. That way
# an exception can be raised if set_get_returns_none is turned
# off.
- data = apply(self.db.get, args, kw)
+ data = self.db.get(*args, **kw)
try:
return cPickle.loads(data)
except (TypeError, cPickle.UnpicklingError):
@@ -236,7 +236,7 @@ class DBShelfCursor:
def get(self, *args):
count = len(args) # a method overloading hack
method = getattr(self, 'get_%d' % count)
- apply(method, args)
+ method(*args)
def get_1(self, flags):
rec = self.dbc.get(flags)
diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py
index 24c4038..7e8f835 100644
--- a/Lib/bsddb/test/test_basics.py
+++ b/Lib/bsddb/test/test_basics.py
@@ -444,7 +444,7 @@ class BasicTestCase(unittest.TestCase):
print "attempting to use a closed cursor's %s method" % \
method
# a bug may cause a NULL pointer dereference...
- apply(getattr(c, method), args)
+ getattr(c, method)(*args)
except db.DBError, val:
assert val[0] == 0
if verbose: print val
diff --git a/Lib/bsddb/test/test_dbobj.py b/Lib/bsddb/test/test_dbobj.py
index 6799fc9..1305883 100644
--- a/Lib/bsddb/test/test_dbobj.py
+++ b/Lib/bsddb/test/test_dbobj.py
@@ -39,7 +39,7 @@ class dbobjTestCase(unittest.TestCase):
def put(self, key, *args, **kwargs):
key = string.upper(key)
# call our parent classes put method with an upper case key
- return apply(dbobj.DB.put, (self, key) + args, kwargs)
+ return dbobj.DB.put(self, key, *args, **kwargs)
self.env = TestDBEnv()
self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL)
self.db = TestDB(self.env)
diff --git a/Lib/bsddb/test/test_join.py b/Lib/bsddb/test/test_join.py
index 73edd11..69a1e9d 100644
--- a/Lib/bsddb/test/test_join.py
+++ b/Lib/bsddb/test/test_join.py
@@ -72,13 +72,13 @@ class JoinTestCase(unittest.TestCase):
# create and populate primary index
priDB = db.DB(self.env)
priDB.open(self.filename, "primary", db.DB_BTREE, db.DB_CREATE)
- map(lambda t, priDB=priDB: apply(priDB.put, t), ProductIndex)
+ map(lambda t, priDB=priDB: priDB.put(*t), ProductIndex)
# create and populate secondary index
secDB = db.DB(self.env)
secDB.set_flags(db.DB_DUP | db.DB_DUPSORT)
secDB.open(self.filename, "secondary", db.DB_BTREE, db.DB_CREATE)
- map(lambda t, secDB=secDB: apply(secDB.put, t), ColorIndex)
+ map(lambda t, secDB=secDB: secDB.put(*t), ColorIndex)
sCursor = None
jCursor = None
diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py
index cc91b4f..504e283 100644
--- a/Lib/compiler/transformer.py
+++ b/Lib/compiler/transformer.py
@@ -90,7 +90,7 @@ def Node(*args):
raise
else:
raise WalkerError, "Can't find appropriate Node type: %s" % str(args)
- #return apply(ast.Node, args)
+ #return ast.Node(*args)
class Transformer:
"""Utility object for transforming Python parse trees.
diff --git a/Lib/distutils/archive_util.py b/Lib/distutils/archive_util.py
index 6aa5e63..b725a14 100644
--- a/Lib/distutils/archive_util.py
+++ b/Lib/distutils/archive_util.py
@@ -162,7 +162,7 @@ def make_archive (base_name, format,
func = format_info[0]
for (arg,val) in format_info[1]:
kwargs[arg] = val
- filename = apply(func, (base_name, base_dir), kwargs)
+ filename = func(base_name, base_dir, **kwargs)
if root_dir is not None:
log.debug("changing back to '%s'", save_cwd)
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index 4191c76..6ea5d57 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -613,8 +613,8 @@ class build_ext (Command):
# extensions in debug_mode are named 'module_d.pyd' under windows
so_ext = get_config_var('SO')
if os.name == 'nt' and self.debug:
- return apply(os.path.join, ext_path) + '_d' + so_ext
- return apply(os.path.join, ext_path) + so_ext
+ return os.path.join(*ext_path) + '_d' + so_ext
+ return os.path.join(*ext_path) + so_ext
def get_export_symbols (self, ext):
"""Return the list of symbols that a shared extension has to
diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py
index 621bcb4..3b7ec62 100644
--- a/Lib/distutils/command/build_py.py
+++ b/Lib/distutils/command/build_py.py
@@ -154,7 +154,7 @@ class build_py (Command):
if not self.package_dir:
if path:
- return apply(os.path.join, path)
+ return os.path.join(*path)
else:
return ''
else:
@@ -167,7 +167,7 @@ class build_py (Command):
del path[-1]
else:
tail.insert(0, pdir)
- return apply(os.path.join, tail)
+ return os.path.join(*tail)
else:
# Oops, got all the way through 'path' without finding a
# match in package_dir. If package_dir defines a directory
@@ -181,7 +181,7 @@ class build_py (Command):
tail.insert(0, pdir)
if tail:
- return apply(os.path.join, tail)
+ return os.path.join(*tail)
else:
return ''
@@ -335,7 +335,7 @@ class build_py (Command):
def get_module_outfile (self, build_dir, package, module):
outfile_path = [build_dir] + list(package) + [module + ".py"]
- return apply(os.path.join, outfile_path)
+ return os.path.join(*outfile_path)
def get_outputs (self, include_bytecode=1):
diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py
index 43994db..a4aff58 100644
--- a/Lib/distutils/dir_util.py
+++ b/Lib/distutils/dir_util.py
@@ -204,7 +204,7 @@ def remove_tree (directory, verbose=0, dry_run=0):
_build_cmdtuple(directory, cmdtuples)
for cmd in cmdtuples:
try:
- apply(cmd[0], (cmd[1],))
+ cmd[0](cmd[1])
# remove dir from cache if it's already there
abspath = os.path.abspath(cmd[1])
if _path_created.has_key(abspath):
diff --git a/Lib/distutils/filelist.py b/Lib/distutils/filelist.py
index 43f9aaa..4bbdd1f 100644
--- a/Lib/distutils/filelist.py
+++ b/Lib/distutils/filelist.py
@@ -69,7 +69,7 @@ class FileList:
sortable_files.sort()
self.files = []
for sort_tuple in sortable_files:
- self.files.append(apply(os.path.join, sort_tuple))
+ self.files.append(os.path.join(*sort_tuple))
# -- Other miscellaneous utility methods ---------------------------
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 387e9bd..889bf13 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -95,7 +95,7 @@ def convert_path (pathname):
paths.remove('.')
if not paths:
return os.curdir
- return apply(os.path.join, paths)
+ return os.path.join(*paths)
# convert_path ()
@@ -295,7 +295,7 @@ def execute (func, args, msg=None, verbose=0, dry_run=0):
log.info(msg)
if not dry_run:
- apply(func, args)
+ func(*args)
def strtobool (val):
diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py
index ea8b140..4f53115 100644
--- a/Lib/idlelib/MultiCall.py
+++ b/Lib/idlelib/MultiCall.py
@@ -296,7 +296,7 @@ def MultiCallCreator(widget):
assert issubclass(widget, Tkinter.Misc)
def __init__(self, *args, **kwargs):
- apply(widget.__init__, (self,)+args, kwargs)
+ widget.__init__(self, *args, **kwargs)
# a dictionary which maps a virtual event to a tuple with:
# 0. the function binded
# 1. a list of triplets - the sequences it is binded to
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index d82d667..862f7ca 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -965,7 +965,7 @@ class Logger(Filterer):
if self.manager.disable >= DEBUG:
return
if DEBUG >= self.getEffectiveLevel():
- apply(self._log, (DEBUG, msg, args), kwargs)
+ self._log(DEBUG, msg, args, **kwargs)
def info(self, msg, *args, **kwargs):
"""
@@ -979,7 +979,7 @@ class Logger(Filterer):
if self.manager.disable >= INFO:
return
if INFO >= self.getEffectiveLevel():
- apply(self._log, (INFO, msg, args), kwargs)
+ self._log(INFO, msg, args, **kwargs)
def warning(self, msg, *args, **kwargs):
"""
@@ -993,7 +993,7 @@ class Logger(Filterer):
if self.manager.disable >= WARNING:
return
if self.isEnabledFor(WARNING):
- apply(self._log, (WARNING, msg, args), kwargs)
+ self._log(WARNING, msg, args, **kwargs)
warn = warning
@@ -1009,13 +1009,13 @@ class Logger(Filterer):
if self.manager.disable >= ERROR:
return
if self.isEnabledFor(ERROR):
- apply(self._log, (ERROR, msg, args), kwargs)
+ self._log(ERROR, msg, args, **kwargs)
def exception(self, msg, *args):
"""
Convenience method for logging an ERROR with exception information.
"""
- apply(self.error, (msg,) + args, {'exc_info': 1})
+ self.error(msg, *args, exc_info=1)
def critical(self, msg, *args, **kwargs):
"""
@@ -1029,7 +1029,7 @@ class Logger(Filterer):
if self.manager.disable >= CRITICAL:
return
if CRITICAL >= self.getEffectiveLevel():
- apply(self._log, (CRITICAL, msg, args), kwargs)
+ self._log(CRITICAL, msg, args, **kwargs)
fatal = critical
@@ -1050,7 +1050,7 @@ class Logger(Filterer):
if self.manager.disable >= level:
return
if self.isEnabledFor(level):
- apply(self._log, (level, msg, args), kwargs)
+ self._log(level, msg, args, **kwargs)
def findCaller(self):
"""
@@ -1275,7 +1275,7 @@ def critical(msg, *args, **kwargs):
"""
if len(root.handlers) == 0:
basicConfig()
- apply(root.critical, (msg,)+args, kwargs)
+ root.critical(msg, *args, **kwargs)
fatal = critical
@@ -1285,14 +1285,14 @@ def error(msg, *args, **kwargs):
"""
if len(root.handlers) == 0:
basicConfig()
- apply(root.error, (msg,)+args, kwargs)
+ root.error(msg, *args, **kwargs)
def exception(msg, *args):
"""
Log a message with severity 'ERROR' on the root logger,
with exception information.
"""
- apply(error, (msg,)+args, {'exc_info': 1})
+ error(msg, *args, exc_info=1)
def warning(msg, *args, **kwargs):
"""
@@ -1300,7 +1300,7 @@ def warning(msg, *args, **kwargs):
"""
if len(root.handlers) == 0:
basicConfig()
- apply(root.warning, (msg,)+args, kwargs)
+ root.warning(msg, *args, **kwargs)
warn = warning
@@ -1310,7 +1310,7 @@ def info(msg, *args, **kwargs):
"""
if len(root.handlers) == 0:
basicConfig()
- apply(root.info, (msg,)+args, kwargs)
+ root.info(msg, *args, **kwargs)
def debug(msg, *args, **kwargs):
"""
@@ -1318,7 +1318,7 @@ def debug(msg, *args, **kwargs):
"""
if len(root.handlers) == 0:
basicConfig()
- apply(root.debug, (msg,)+args, kwargs)
+ root.debug(msg, *args, **kwargs)
def log(level, msg, *args, **kwargs):
"""
@@ -1326,7 +1326,7 @@ def log(level, msg, *args, **kwargs):
"""
if len(root.handlers) == 0:
basicConfig()
- apply(root.log, (level, msg)+args, kwargs)
+ root.log(level, msg, *args, **kwargs)
def disable(level):
"""
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 5adfe4d..457ec5c 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -148,7 +148,7 @@ def _install_handlers(cp, formatters):
klass = eval(klass, vars(logging))
args = cp.get(sectname, "args")
args = eval(args, vars(logging))
- h = apply(klass, args)
+ h = klass(*args)
if "level" in opts:
level = cp.get(sectname, "level")
h.setLevel(logging._levelNames[level])
diff --git a/Lib/plat-mac/gensuitemodule.py b/Lib/plat-mac/gensuitemodule.py
index 87132c5..03d38f6 100644
--- a/Lib/plat-mac/gensuitemodule.py
+++ b/Lib/plat-mac/gensuitemodule.py
@@ -351,11 +351,11 @@ def alt_generic(what, f, *args):
def generic(what, f, *args):
if type(what) == types.FunctionType:
- return apply(what, (f,) + args)
+ return what(f, *args)
if type(what) == types.ListType:
record = []
for thing in what:
- item = apply(generic, thing[:1] + (f,) + thing[1:])
+ item = generic(thing[:1], f, *thing[1:])
record.append((thing[1], item))
return record
return "BAD GENERIC ARGS: %r" % (what,)
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 9cb03bc..6827244 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -995,7 +995,7 @@ class Popen(object):
os.chdir(cwd)
if preexec_fn:
- apply(preexec_fn)
+ preexec_fn()
if env is None:
os.execvp(executable, args)
diff --git a/Lib/test/crashers/infinite_rec_4.py b/Lib/test/crashers/infinite_rec_4.py
deleted file mode 100644
index 14f1520..0000000
--- a/Lib/test/crashers/infinite_rec_4.py
+++ /dev/null
@@ -1,7 +0,0 @@
-
-# http://python.org/sf/1202533
-
-if __name__ == '__main__':
- lst = [apply]
- lst.append(lst)
- apply(*lst) # segfault: infinite recursion in C
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 4f10d92..6f11fdd 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -153,32 +153,6 @@ class BuiltinTest(unittest.TestCase):
S = [10, 20, 30]
self.assertEqual(any(x > 42 for x in S), False)
- def test_apply(self):
- def f0(*args):
- self.assertEqual(args, ())
- def f1(a1):
- self.assertEqual(a1, 1)
- def f2(a1, a2):
- self.assertEqual(a1, 1)
- self.assertEqual(a2, 2)
- def f3(a1, a2, a3):
- self.assertEqual(a1, 1)
- self.assertEqual(a2, 2)
- self.assertEqual(a3, 3)
- apply(f0, ())
- apply(f1, (1,))
- apply(f2, (1, 2))
- apply(f3, (1, 2, 3))
-
- # A PyCFunction that takes only positional parameters should allow an
- # empty keyword dictionary to pass without a complaint, but raise a
- # TypeError if the dictionary is non-empty.
- apply(id, (1,), {})
- self.assertRaises(TypeError, apply, id, (1,), {"foo": 1})
- self.assertRaises(TypeError, apply)
- self.assertRaises(TypeError, apply, id, 42)
- self.assertRaises(TypeError, apply, id, (42,), 42)
-
def test_callable(self):
self.assert_(callable(len))
def f(): pass