Skip to content

Commit 14c180b

Browse files
committed
Update inspect.getargspec (deleted in Python 3.11) to .getfullargspec.
PiperOrigin-RevId: 530329819
1 parent 04a895d commit 14c180b

File tree

1 file changed

+3
-3
lines changed
  • tensorflow_probability/python/experimental/auto_batching

1 file changed

+3
-3
lines changed

tensorflow_probability/python/experimental/auto_batching/dsl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,16 +307,16 @@ def primop(self, f, vars_in=None, vars_out=None):
307307
if vars_in is None:
308308
# Deduce the intended variable names from the argument list of the callee.
309309
# Expected use case: the callee is an inline lambda expression.
310-
args, varargs, keywords, _ = inspect.getargspec(f)
310+
args, varargs, varkw, _, kwonlyargs, _, _ = inspect.getfullargspec(f)
311311
vars_in = []
312-
for arg in args:
312+
for arg in args + kwonlyargs:
313313
if arg in self._locals:
314314
vars_in.append(self._locals[arg])
315315
else:
316316
raise ValueError('Auto-referencing unbound variable {}.'.format(arg))
317317
if varargs is not None:
318318
raise ValueError('Varargs are not supported for primops')
319-
if keywords is not None:
319+
if varkw is not None:
320320
raise ValueError('kwargs are not supported for primops')
321321
for var in vars_in:
322322
if var not in self._var_defs:

0 commit comments

Comments
 (0)