New submission from Batuhan Taskaya <isidenti...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue44313>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to