CallableArgCount returns the number of arguments declared in the callable Python object.
()
| 348 | |
| 349 | // CallableArgCount returns the number of arguments declared in the callable Python object. |
| 350 | func (ob *PyObject) CallableArgCount() uint32 { |
| 351 | fnCode, err := ob.GetAttrString("__code__") |
| 352 | if err != nil || fnCode.IsNull() { |
| 353 | return 0 |
| 354 | } |
| 355 | defer fnCode.DecRef() |
| 356 | count, err := fnCode.GetAttrString("co_argcount") |
| 357 | if err != nil { |
| 358 | return 0 |
| 359 | } |
| 360 | defer count.DecRef() |
| 361 | return count.Uint32() |
| 362 | } |
| 363 | |
| 364 | // Call calls a callable Python object with arguments given by the tuple args. If no arguments are needed, then args |
| 365 | // may be NULL. Returns the result of the call on success, or a null reference on failure. |
no test coverage detected