File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,16 @@ struct _Py_global_strings {
372372#define _Py_STR (NAME ) \
373373 (_Py_SINGLETON (strings .literals ._ ## NAME ._ascii .ob_base ))
374374
375+ /* _Py_DECLARE_STR() should precede all uses of _Py_STR() in a function.
376+
377+ This is true even if the same string has already been declared
378+ elsewhere, even in the same file. Mismatched duplicates are detected
379+ by Tools/scripts/generate-global-objects.py.
380+
381+ Pairing _Py_DECLARE_STR() with every use of _Py_STR() makes sure the
382+ string keeps working even if the declaration is removed somewhere
383+ else. It also makes it clear what the actual string is at every
384+ place it is being used. */
375385#define _Py_DECLARE_STR (name , str )
376386
377387#ifdef __cplusplus
You can’t perform that action at this time.
0 commit comments