summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-11-07 20:06:23 (GMT)
committerGitHub <noreply@github.com>2022-11-07 20:06:23 (GMT)
commitbe0d5008b3caad8e18b45ba6668556081f1c0ba5 (patch)
treea397ebde862040475e6d099e60dc99c4875f9141 /Include
parent1438b779971605e516bd0a4051a704d6ffbbd58d (diff)
downloadcpython-be0d5008b3caad8e18b45ba6668556081f1c0ba5.zip
cpython-be0d5008b3caad8e18b45ba6668556081f1c0ba5.tar.gz
cpython-be0d5008b3caad8e18b45ba6668556081f1c0ba5.tar.bz2
GH-90699: Remove remaining `_Py_IDENTIFIER` stdlib usage (GH-99067)
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_global_strings.h18
-rw-r--r--Include/internal/pycore_runtime_init.h4
-rw-r--r--Include/internal/pycore_runtime_init_generated.h56
3 files changed, 71 insertions, 7 deletions
diff --git a/Include/internal/pycore_global_strings.h b/Include/internal/pycore_global_strings.h
index 8912895..8588aae 100644
--- a/Include/internal/pycore_global_strings.h
+++ b/Include/internal/pycore_global_strings.h
@@ -11,7 +11,7 @@ extern "C" {
// The data structure & init here are inspired by Tools/build/deepfreeze.py.
// All field names generated by ASCII_STR() have a common prefix,
-// to help avoid collisions with keywords, etc.
+// to help avoid collisions with keywords, macros, etc.
#define STRUCT_FOR_ASCII_STR(LITERAL) \
struct { \
@@ -19,9 +19,9 @@ extern "C" {
uint8_t _data[sizeof(LITERAL)]; \
}
#define STRUCT_FOR_STR(NAME, LITERAL) \
- STRUCT_FOR_ASCII_STR(LITERAL) _ ## NAME;
+ STRUCT_FOR_ASCII_STR(LITERAL) _py_ ## NAME;
#define STRUCT_FOR_ID(NAME) \
- STRUCT_FOR_ASCII_STR(#NAME) _ ## NAME;
+ STRUCT_FOR_ASCII_STR(#NAME) _py_ ## NAME;
// XXX Order by frequency of use?
@@ -246,6 +246,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(_showwarnmsg)
STRUCT_FOR_ID(_shutdown)
STRUCT_FOR_ID(_slotnames)
+ STRUCT_FOR_ID(_strptime_datetime)
STRUCT_FOR_ID(_swappedbytes_)
STRUCT_FOR_ID(_type_)
STRUCT_FOR_ID(_uninitialized_submodules)
@@ -264,6 +265,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(argdefs)
STRUCT_FOR_ID(arguments)
STRUCT_FOR_ID(argv)
+ STRUCT_FOR_ID(as_integer_ratio)
STRUCT_FOR_ID(attribute)
STRUCT_FOR_ID(authorizer_callback)
STRUCT_FOR_ID(b)
@@ -403,6 +405,8 @@ struct _Py_global_strings {
STRUCT_FOR_ID(frequency)
STRUCT_FOR_ID(from_param)
STRUCT_FOR_ID(fromlist)
+ STRUCT_FOR_ID(fromtimestamp)
+ STRUCT_FOR_ID(fromutc)
STRUCT_FOR_ID(fset)
STRUCT_FOR_ID(func)
STRUCT_FOR_ID(future)
@@ -448,6 +452,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(intersection)
STRUCT_FOR_ID(isatty)
STRUCT_FOR_ID(isinstance)
+ STRUCT_FOR_ID(isoformat)
STRUCT_FOR_ID(isolation_level)
STRUCT_FOR_ID(istext)
STRUCT_FOR_ID(item)
@@ -636,6 +641,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(step)
STRUCT_FOR_ID(store_name)
STRUCT_FOR_ID(strategy)
+ STRUCT_FOR_ID(strftime)
STRUCT_FOR_ID(strict)
STRUCT_FOR_ID(strict_mode)
STRUCT_FOR_ID(string)
@@ -658,6 +664,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(throw)
STRUCT_FOR_ID(timeout)
STRUCT_FOR_ID(times)
+ STRUCT_FOR_ID(timetuple)
STRUCT_FOR_ID(top)
STRUCT_FOR_ID(trace_callback)
STRUCT_FOR_ID(traceback)
@@ -669,6 +676,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(txt)
STRUCT_FOR_ID(type)
STRUCT_FOR_ID(tz)
+ STRUCT_FOR_ID(tzname)
STRUCT_FOR_ID(uid)
STRUCT_FOR_ID(unlink)
STRUCT_FOR_ID(unraisablehook)
@@ -708,9 +716,9 @@ struct _Py_global_strings {
#define _Py_ID(NAME) \
- (_Py_SINGLETON(strings.identifiers._ ## NAME._ascii.ob_base))
+ (_Py_SINGLETON(strings.identifiers._py_ ## NAME._ascii.ob_base))
#define _Py_STR(NAME) \
- (_Py_SINGLETON(strings.literals._ ## NAME._ascii.ob_base))
+ (_Py_SINGLETON(strings.literals._py_ ## NAME._ascii.ob_base))
/* _Py_DECLARE_STR() should precede all uses of _Py_STR() in a function.
diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h
index 8dd7a31..3acb16b 100644
--- a/Include/internal/pycore_runtime_init.h
+++ b/Include/internal/pycore_runtime_init.h
@@ -110,9 +110,9 @@ extern "C" {
._data = (LITERAL) \
}
#define INIT_STR(NAME, LITERAL) \
- ._ ## NAME = _PyASCIIObject_INIT(LITERAL)
+ ._py_ ## NAME = _PyASCIIObject_INIT(LITERAL)
#define INIT_ID(NAME) \
- ._ ## NAME = _PyASCIIObject_INIT(#NAME)
+ ._py_ ## NAME = _PyASCIIObject_INIT(#NAME)
#define _PyUnicode_LATIN1_INIT(LITERAL, UTF8) \
{ \
._latin1 = { \
diff --git a/Include/internal/pycore_runtime_init_generated.h b/Include/internal/pycore_runtime_init_generated.h
index a1f1efd..28660aa 100644
--- a/Include/internal/pycore_runtime_init_generated.h
+++ b/Include/internal/pycore_runtime_init_generated.h
@@ -755,6 +755,7 @@ extern "C" {
INIT_ID(_showwarnmsg), \
INIT_ID(_shutdown), \
INIT_ID(_slotnames), \
+ INIT_ID(_strptime_datetime), \
INIT_ID(_swappedbytes_), \
INIT_ID(_type_), \
INIT_ID(_uninitialized_submodules), \
@@ -773,6 +774,7 @@ extern "C" {
INIT_ID(argdefs), \
INIT_ID(arguments), \
INIT_ID(argv), \
+ INIT_ID(as_integer_ratio), \
INIT_ID(attribute), \
INIT_ID(authorizer_callback), \
INIT_ID(b), \
@@ -912,6 +914,8 @@ extern "C" {
INIT_ID(frequency), \
INIT_ID(from_param), \
INIT_ID(fromlist), \
+ INIT_ID(fromtimestamp), \
+ INIT_ID(fromutc), \
INIT_ID(fset), \
INIT_ID(func), \
INIT_ID(future), \
@@ -957,6 +961,7 @@ extern "C" {
INIT_ID(intersection), \
INIT_ID(isatty), \
INIT_ID(isinstance), \
+ INIT_ID(isoformat), \
INIT_ID(isolation_level), \
INIT_ID(istext), \
INIT_ID(item), \
@@ -1145,6 +1150,7 @@ extern "C" {
INIT_ID(step), \
INIT_ID(store_name), \
INIT_ID(strategy), \
+ INIT_ID(strftime), \
INIT_ID(strict), \
INIT_ID(strict_mode), \
INIT_ID(string), \
@@ -1167,6 +1173,7 @@ extern "C" {
INIT_ID(throw), \
INIT_ID(timeout), \
INIT_ID(times), \
+ INIT_ID(timetuple), \
INIT_ID(top), \
INIT_ID(trace_callback), \
INIT_ID(traceback), \
@@ -1178,6 +1185,7 @@ extern "C" {
INIT_ID(txt), \
INIT_ID(type), \
INIT_ID(tz), \
+ INIT_ID(tzname), \
INIT_ID(uid), \
INIT_ID(unlink), \
INIT_ID(unraisablehook), \
@@ -1860,6 +1868,8 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(_slotnames);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(_strptime_datetime);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(_swappedbytes_);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(_type_);
@@ -1896,6 +1906,8 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(argv);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(as_integer_ratio);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(attribute);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(authorizer_callback);
@@ -2174,6 +2186,10 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(fromlist);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(fromtimestamp);
+ PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(fromutc);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(fset);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(func);
@@ -2264,6 +2280,8 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(isinstance);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(isoformat);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(isolation_level);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(istext);
@@ -2640,6 +2658,8 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(strategy);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(strftime);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(strict);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(strict_mode);
@@ -2684,6 +2704,8 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(times);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(timetuple);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(top);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(trace_callback);
@@ -2706,6 +2728,8 @@ _PyUnicode_InitStaticStrings(void) {
PyUnicode_InternInPlace(&string);
string = &_Py_ID(tz);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(tzname);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(uid);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(unlink);
@@ -5691,6 +5715,10 @@ _PyStaticObjects_CheckRefcnt(void) {
_PyObject_Dump((PyObject *)&_Py_ID(_slotnames));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(_strptime_datetime)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(_strptime_datetime));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(_swappedbytes_)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(_swappedbytes_));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
@@ -5763,6 +5791,10 @@ _PyStaticObjects_CheckRefcnt(void) {
_PyObject_Dump((PyObject *)&_Py_ID(argv));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(as_integer_ratio)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(as_integer_ratio));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(attribute)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(attribute));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
@@ -6319,6 +6351,14 @@ _PyStaticObjects_CheckRefcnt(void) {
_PyObject_Dump((PyObject *)&_Py_ID(fromlist));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(fromtimestamp)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(fromtimestamp));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
+ if (Py_REFCNT((PyObject *)&_Py_ID(fromutc)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(fromutc));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(fset)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(fset));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
@@ -6499,6 +6539,10 @@ _PyStaticObjects_CheckRefcnt(void) {
_PyObject_Dump((PyObject *)&_Py_ID(isinstance));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(isoformat)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(isoformat));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(isolation_level)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(isolation_level));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
@@ -7251,6 +7295,10 @@ _PyStaticObjects_CheckRefcnt(void) {
_PyObject_Dump((PyObject *)&_Py_ID(strategy));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(strftime)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(strftime));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(strict)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(strict));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
@@ -7339,6 +7387,10 @@ _PyStaticObjects_CheckRefcnt(void) {
_PyObject_Dump((PyObject *)&_Py_ID(times));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(timetuple)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(timetuple));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(top)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(top));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
@@ -7383,6 +7435,10 @@ _PyStaticObjects_CheckRefcnt(void) {
_PyObject_Dump((PyObject *)&_Py_ID(tz));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(tzname)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(tzname));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(uid)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(uid));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");