[all-commits] [llvm/llvm-project] c86a6a: clean up the implementation of PythonCallable::Get...

llvm-git-migration via All-commits all-commits at lists.llvm.org
Thu Oct 17 15:20:54 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c86a6acaee55c98072ff06d372d049cb4a671fb5
      https://github.com/llvm/llvm-project/commit/c86a6acaee55c98072ff06d372d049cb4a671fb5
  Author: Lawrence D'Anna <lawrence_danna at apple.com>
  Date:   2019-10-17 (Thu, 17 Oct 2019)

  Changed paths:
    M lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
    M lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

  Log Message:
  -----------
  clean up the implementation of PythonCallable::GetNumArguments

Summary:
The current implementation of PythonCallable::GetNumArguments
is not exception safe, has weird semantics, and is just plain
incorrect for some kinds of functions.

Python 3.3 introduces inspect.signature, which lets us easily
query for function signatures in a sane and documented way.

This patch leaves the old implementation in place for < 3.3,
but uses inspect.signature for modern pythons.   It also leaves
the old weird semantics in place, but with FIXMEs grousing about
it.   We should update the callers and fix the semantics in a
subsequent patch.    It also adds some tests.

Reviewers: JDevlieghere, clayborg, labath, jingham

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68995

llvm-svn: 375181




More information about the All-commits mailing list