Skip to content
Open
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
970e3d9
allow a mapping, rather than just a dict subclass, as globals
blhsing Jul 5, 2024
cf9945e
fixed typo
blhsing Jul 5, 2024
55f6dd4
regenerated header files
blhsing Jul 5, 2024
0d347f8
fixed error handling of DELETE_GLOBAL
blhsing Jul 5, 2024
4e1af59
fixed borrowed builtins reference
blhsing Jul 5, 2024
40f7c35
fixed error handling
blhsing Jul 5, 2024
698aa1f
use PyMapping_HasKeyStringWithError for proper error handling
blhsing Jul 5, 2024
fa1dcac
fixed usage of id __lltrace__
blhsing Jul 5, 2024
4343867
made _PyEval_BuiltinsFromGlobals return a new, non-borrowed reference
blhsing Jul 5, 2024
c5b38b0
release reference to builtins module
blhsing Jul 5, 2024
0daa66b
streamline code
blhsing Jul 5, 2024
2852b8f
added dict-specific path for insertion of __builtins__ into globals
blhsing Jul 5, 2024
5120260
try PyDict_* before PyMapping_*
blhsing Jul 5, 2024
723d665
switch from EAFP to LBYL
blhsing Jul 5, 2024
3908ee8
fixed typo
blhsing Jul 5, 2024
4a14682
dict-specific path for function
blhsing Jul 5, 2024
ab2974e
more dict-specific paths
blhsing Jul 5, 2024
1218ab7
minor adjustments
blhsing Jul 5, 2024
375af2b
📜🤖 Added by blurb_it.
blurb-it[bot] Jul 5, 2024
06b225b
removed redundant PyDict_Check; streamlined code
blhsing Jul 8, 2024
d584987
fixed check for null globals
blhsing Jul 8, 2024
3d3a563
updated docs
blhsing Jul 8, 2024
8bbc34c
minor update to docs
blhsing Jul 8, 2024
ca2ea12
updated tests
blhsing Jul 8, 2024
0f9e289
Update 2024-07-05-16-24-14.gh-issue-121306.nUBgho.rst
blhsing Jul 8, 2024
186ee55
Update 2024-07-05-16-24-14.gh-issue-121306.nUBgho.rst
blhsing Jul 8, 2024
190c09f
fixed reference count
blhsing Jul 8, 2024
09df171
Merge branch 'master' into allow-mapping-as-globals
blhsing Jul 8, 2024
1949be7
updated test to validate evaluated result
blhsing Jul 9, 2024
bb888ff
updated style
blhsing Jul 9, 2024
db01f51
regen headers
blhsing Jul 9, 2024
f0cd4e8
removed comments that are no longer applicable
blhsing Jul 9, 2024
d7d7d04
allow a mapping to be object.__dict__ and by extension module.__dict_…
blhsing Jul 11, 2024
cab9a52
simplified macros for unified dict/mapping API
blhsing Jul 11, 2024
f8c62c6
corrected comments
blhsing Jul 11, 2024
aa2d9b4
regen headers
blhsing Jul 11, 2024
362e0ac
fixed headers
blhsing Jul 11, 2024
bf7be59
simplified macro
blhsing Jul 11, 2024
0bf8239
fixed reference count
blhsing Jul 11, 2024
278c2ca
fixed typo in doc
blhsing Jul 11, 2024
d6735b9
fixed reference count
blhsing Jul 11, 2024
18dad2b
fixed possible uninitialized usage
blhsing Jul 11, 2024
35ada07
fixed logical operation
blhsing Jul 11, 2024
2e6a88a
updated tests
blhsing Jul 11, 2024
c29a10c
added test for mapping __dict__ for module; DRYer code with better ma…
blhsing Jul 12, 2024
3513a29
updated comment
blhsing Jul 12, 2024
97b813d
updated comment
blhsing Jul 12, 2024
6ea65b9
reformatted code; updated news
blhsing Jul 12, 2024
8137cab
reformatted code for clarity
blhsing Jul 12, 2024
725a327
fixed typo
blhsing Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplified macro
  • Loading branch information
blhsing committed Jul 11, 2024
commit bf7be59e549ef45b53db54baa57df0c5cb36d47b
12 changes: 6 additions & 6 deletions Objects/moduleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ module_init_dict(PyModuleObject *mod, PyObject *md_dict,
int r;

#define _Py_MODULE_INIT_SETATTR(name, value) \
_Py_DICT_OR_MAPPING_SETITEM(md_dict, name, value, r) \
_Py_DICT_OR_MAPPING_SETITEM(md_dict, &_Py_ID(name), value, r) \
if (r != 0) { \
return -1; \
}

_Py_MODULE_INIT_SETATTR(&_Py_ID(__name__), name)
_Py_MODULE_INIT_SETATTR(&_Py_ID(__doc__), doc)
_Py_MODULE_INIT_SETATTR(&_Py_ID(__package__), Py_None)
_Py_MODULE_INIT_SETATTR(&_Py_ID(__loader__), Py_None)
_Py_MODULE_INIT_SETATTR(&_Py_ID(__spec__), Py_None)
_Py_MODULE_INIT_SETATTR(__name__, name)
_Py_MODULE_INIT_SETATTR(__doc__, doc)
_Py_MODULE_INIT_SETATTR(__package__, Py_None)
_Py_MODULE_INIT_SETATTR(__loader__, Py_None)
_Py_MODULE_INIT_SETATTR(__spec__, Py_None)
if (PyUnicode_CheckExact(name)) {
Py_XSETREF(mod->md_name, Py_NewRef(name));
}
Expand Down