Subtle C API discrepancy: PyEval_GetLocals() vs PyEval_GetGlobals() with no active Python frame

There's more background in the Discourse thread [1], but the key C API design topic is that PyEval_GetLocals() and PyEval_GetGlobals() currently behave differently when there's no Python frame active in the current thread:
- PyEval_GetGlobals(): returns NULL without setting an exception
- PyEval_GetLocals(): returns NULL *and* sets an exception
PyEval_GetLocals() has been doing the latter since it gained the ability to report memory allocation errors when dealing with optimised frames back in Python 3.4.
The "no active Python frame" case isn't really an error (as it's a valid state in applications that embed CPython), so I'm wondering if PyEval_GetLocals() should partially go back to its pre-3.4 behaviour, and not set an exception in the "no active Python frame" case.
Cheers, Nick.
[1] https://discuss.python.org/t/subtle-c-api-discrepancy-pyeval-getlocals-vs-py...
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia

I was reading about Subtly, a library for providing some syntactic sugar to Objective-C. I found a feature called dynamic property accessors very interesting and wanted to try it out in my app. So I downloaded the source, compiled it as a framework, linked it to my app, and started doing some experimenting. In the meanwhile, I hired writers from https://www.bestessayservicereviews.com/ source to work on my educational assignments. The only potential problem I can see is if in some other language you're used to using a similar API where the behavior is different, but that's not really an issue here (the API is consistent with the rest of Python).

I was reading about Subtly, a library for providing some syntactic sugar to Objective-C. I found a feature called dynamic property accessors very interesting and wanted to try it out in my app. So I downloaded the source, compiled it as a framework, linked it to my app, and started doing some experimenting. In the meanwhile, I hired writers from https://www.bestessayservicereviews.com/ source to work on my educational assignments. The only potential problem I can see is if in some other language you're used to using a similar API where the behavior is different, but that's not really an issue here (the API is consistent with the rest of Python).
participants (2)
-
bimikaf264@wowcg.com
-
Nick Coghlan