Skip to content

Function not called when argument expression is buggy #136869

@choucroute1958

Description

@choucroute1958

I have written the following function :

def cand (a,b) :
   if (a) :
      if (b) :
         return true
      else :
         return false
   else :
      return false

If I (try to) call it with :

i = 'none'
limit = 5
cand (type (i) is int, i > limit)

I get an error :

TypeError: '>' not supported between instances of 'int' and 'str'

In fact the function is not called. If I put a print in it, it is not displayed.
For me it is a bug. The function must be called and the second element not evaluated before calling the function but only if requested by the function code.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions