A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-July/140741.html below:

[Python-Dev] cpython: locals dictionary in PyRun_String

[Python-Dev] cpython: locals dictionary in PyRun_String [Python-Dev] cpython: locals dictionary in PyRun_StringMatthew Keeter matt.j.keeter at gmail.com
Tue Jul 14 20:28:31 CEST 2015
The docs for PyRun_String say that both globals and locals should be dictionaries [1].

However, digging into the source [2] shows me that locals doesn’t need to be a dictionary;
it just needs to implement the mapping protocol.  Is it a bad idea to rely on this fact?

(Context: I’m plugging a custom object into locals that uses __getitem__ to track lookups.)

Thanks,
Matt

[1] https://docs.python.org/3.4/c-api/veryhigh.html#c.PyRun_StringFlags
[2] https://github.com/python/cpython/blob/master/Objects/frameobject.c#L628-L629
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150714/ad5f8394/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4