[New-bugs-announce] [issue35536] Calling built-in locals() and globals() in C++ leads to SystemError

Никита Сиргиенко report at bugs.python.org
Wed Dec 19 09:54:20 EST 2018


New submission from Никита Сиргиенко <warquark at gmail.com>:

System:
  Distributor ID: Ubuntu
  Description:    Ubuntu 18.04.1 LTS
  Release:        18.04
  Codename:       bionic
  Arch:           x86_64

Compilier:
  g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

Python versions:
  Python 3.6.7-1
  Python 2.7.15rc1

Description:
  This C++ code:

    PyObject* pBuiltin = PyImport_ImportModule("builtins");
    PyObject* py_globals_fun = PyObject_GetAttrString(pBuiltin,"locals");
    PyObject* globals = PyObject_CallObject(py_globals_fun, NULL);

  produces "SystemError: frame does not exist".
  For function "globals" output is "SystemError: returned NULL without 
  setting an error". For python2 this code produces similar errors (descriptions
  of error little different).

  Another functions with arguments, like "abs", works fine.
  And calling function with optional argument, like "int", "float" 
  works with this code (with null parameter) without problem.

----------
components: Library (Lib)
messages: 332144
nosy: Никита Сиргиенко
priority: normal
severity: normal
status: open
title: Calling built-in locals() and globals() in C++ leads to SystemError
type: behavior
versions: Python 2.7, Python 3.6

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


More information about the New-bugs-announce mailing list