[New-bugs-announce] [issue44313] Generate LOAD_ATTR+CALL_FUNCTION instead of LOAD_METHOD+CALL_METHOD for imports

Batuhan Taskaya report at bugs.python.org
Fri Jun 4 12:33:18 EDT 2021


New submission from Batuhan Taskaya <isidentical at gmail.com>:

import foo
def func():
    return foo.bar()

The snippet above will generate the following code;

  2           0 LOAD_GLOBAL              0 (foo)
              2 LOAD_METHOD              1 (bar)
              4 CALL_METHOD              0
              6 RETURN_VALUE

Though this will make things harder for specializing the LOAD_ATTR for modules since now the handling of LOAD_METHOD for that case is necessary so for the imports that we can infer during the symbol analysis pass, we'll generate LOAD_ATTR+CALL_ATTR instead of LOAD_METHOD+CALL_METHOD and hopefully the generated code will get specialized via the PEP 659.

Ref: https://github.com/faster-cpython/ideas/issues/55#issuecomment-853101039

----------
assignee: BTaskaya
components: Interpreter Core
messages: 395099
nosy: BTaskaya, Mark.Shannon
priority: normal
severity: normal
status: open
title: Generate LOAD_ATTR+CALL_FUNCTION instead of LOAD_METHOD+CALL_METHOD for imports
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44313>
_______________________________________


More information about the New-bugs-announce mailing list