mirror of https://github.com/python/cpython
GH-90699: Remove remaining `_Py_IDENTIFIER` stdlib usage (GH-99067)
This commit is contained in:
parent
1438b77997
commit
be0d5008b3
|
@ -11,7 +11,7 @@ extern "C" {
|
||||||
// The data structure & init here are inspired by Tools/build/deepfreeze.py.
|
// The data structure & init here are inspired by Tools/build/deepfreeze.py.
|
||||||
|
|
||||||
// All field names generated by ASCII_STR() have a common prefix,
|
// 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) \
|
#define STRUCT_FOR_ASCII_STR(LITERAL) \
|
||||||
struct { \
|
struct { \
|
||||||
|
@ -19,9 +19,9 @@ extern "C" {
|
||||||
uint8_t _data[sizeof(LITERAL)]; \
|
uint8_t _data[sizeof(LITERAL)]; \
|
||||||
}
|
}
|
||||||
#define STRUCT_FOR_STR(NAME, 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) \
|
#define STRUCT_FOR_ID(NAME) \
|
||||||
STRUCT_FOR_ASCII_STR(#NAME) _ ## NAME;
|
STRUCT_FOR_ASCII_STR(#NAME) _py_ ## NAME;
|
||||||
|
|
||||||
// XXX Order by frequency of use?
|
// XXX Order by frequency of use?
|
||||||
|
|
||||||
|
@ -246,6 +246,7 @@ struct _Py_global_strings {
|
||||||
STRUCT_FOR_ID(_showwarnmsg)
|
STRUCT_FOR_ID(_showwarnmsg)
|
||||||
STRUCT_FOR_ID(_shutdown)
|
STRUCT_FOR_ID(_shutdown)
|
||||||
STRUCT_FOR_ID(_slotnames)
|
STRUCT_FOR_ID(_slotnames)
|
||||||
|
STRUCT_FOR_ID(_strptime_datetime)
|
||||||
STRUCT_FOR_ID(_swappedbytes_)
|
STRUCT_FOR_ID(_swappedbytes_)
|
||||||
STRUCT_FOR_ID(_type_)
|
STRUCT_FOR_ID(_type_)
|
||||||
STRUCT_FOR_ID(_uninitialized_submodules)
|
STRUCT_FOR_ID(_uninitialized_submodules)
|
||||||
|
@ -264,6 +265,7 @@ struct _Py_global_strings {
|
||||||
STRUCT_FOR_ID(argdefs)
|
STRUCT_FOR_ID(argdefs)
|
||||||
STRUCT_FOR_ID(arguments)
|
STRUCT_FOR_ID(arguments)
|
||||||
STRUCT_FOR_ID(argv)
|
STRUCT_FOR_ID(argv)
|
||||||
|
STRUCT_FOR_ID(as_integer_ratio)
|
||||||
STRUCT_FOR_ID(attribute)
|
STRUCT_FOR_ID(attribute)
|
||||||
STRUCT_FOR_ID(authorizer_callback)
|
STRUCT_FOR_ID(authorizer_callback)
|
||||||
STRUCT_FOR_ID(b)
|
STRUCT_FOR_ID(b)
|
||||||
|
@ -403,6 +405,8 @@ struct _Py_global_strings {
|
||||||
STRUCT_FOR_ID(frequency)
|
STRUCT_FOR_ID(frequency)
|
||||||
STRUCT_FOR_ID(from_param)
|
STRUCT_FOR_ID(from_param)
|
||||||
STRUCT_FOR_ID(fromlist)
|
STRUCT_FOR_ID(fromlist)
|
||||||
|
STRUCT_FOR_ID(fromtimestamp)
|
||||||
|
STRUCT_FOR_ID(fromutc)
|
||||||
STRUCT_FOR_ID(fset)
|
STRUCT_FOR_ID(fset)
|
||||||
STRUCT_FOR_ID(func)
|
STRUCT_FOR_ID(func)
|
||||||
STRUCT_FOR_ID(future)
|
STRUCT_FOR_ID(future)
|
||||||
|
@ -448,6 +452,7 @@ struct _Py_global_strings {
|
||||||
STRUCT_FOR_ID(intersection)
|
STRUCT_FOR_ID(intersection)
|
||||||
STRUCT_FOR_ID(isatty)
|
STRUCT_FOR_ID(isatty)
|
||||||
STRUCT_FOR_ID(isinstance)
|
STRUCT_FOR_ID(isinstance)
|
||||||
|
STRUCT_FOR_ID(isoformat)
|
||||||
STRUCT_FOR_ID(isolation_level)
|
STRUCT_FOR_ID(isolation_level)
|
||||||
STRUCT_FOR_ID(istext)
|
STRUCT_FOR_ID(istext)
|
||||||
STRUCT_FOR_ID(item)
|
STRUCT_FOR_ID(item)
|
||||||
|
@ -636,6 +641,7 @@ struct _Py_global_strings {
|
||||||
STRUCT_FOR_ID(step)
|
STRUCT_FOR_ID(step)
|
||||||
STRUCT_FOR_ID(store_name)
|
STRUCT_FOR_ID(store_name)
|
||||||
STRUCT_FOR_ID(strategy)
|
STRUCT_FOR_ID(strategy)
|
||||||
|
STRUCT_FOR_ID(strftime)
|
||||||
STRUCT_FOR_ID(strict)
|
STRUCT_FOR_ID(strict)
|
||||||
STRUCT_FOR_ID(strict_mode)
|
STRUCT_FOR_ID(strict_mode)
|
||||||
STRUCT_FOR_ID(string)
|
STRUCT_FOR_ID(string)
|
||||||
|
@ -658,6 +664,7 @@ struct _Py_global_strings {
|
||||||
STRUCT_FOR_ID(throw)
|
STRUCT_FOR_ID(throw)
|
||||||
STRUCT_FOR_ID(timeout)
|
STRUCT_FOR_ID(timeout)
|
||||||
STRUCT_FOR_ID(times)
|
STRUCT_FOR_ID(times)
|
||||||
|
STRUCT_FOR_ID(timetuple)
|
||||||
STRUCT_FOR_ID(top)
|
STRUCT_FOR_ID(top)
|
||||||
STRUCT_FOR_ID(trace_callback)
|
STRUCT_FOR_ID(trace_callback)
|
||||||
STRUCT_FOR_ID(traceback)
|
STRUCT_FOR_ID(traceback)
|
||||||
|
@ -669,6 +676,7 @@ struct _Py_global_strings {
|
||||||
STRUCT_FOR_ID(txt)
|
STRUCT_FOR_ID(txt)
|
||||||
STRUCT_FOR_ID(type)
|
STRUCT_FOR_ID(type)
|
||||||
STRUCT_FOR_ID(tz)
|
STRUCT_FOR_ID(tz)
|
||||||
|
STRUCT_FOR_ID(tzname)
|
||||||
STRUCT_FOR_ID(uid)
|
STRUCT_FOR_ID(uid)
|
||||||
STRUCT_FOR_ID(unlink)
|
STRUCT_FOR_ID(unlink)
|
||||||
STRUCT_FOR_ID(unraisablehook)
|
STRUCT_FOR_ID(unraisablehook)
|
||||||
|
@ -708,9 +716,9 @@ struct _Py_global_strings {
|
||||||
|
|
||||||
|
|
||||||
#define _Py_ID(NAME) \
|
#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) \
|
#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.
|
/* _Py_DECLARE_STR() should precede all uses of _Py_STR() in a function.
|
||||||
|
|
||||||
|
|
|
@ -110,9 +110,9 @@ extern "C" {
|
||||||
._data = (LITERAL) \
|
._data = (LITERAL) \
|
||||||
}
|
}
|
||||||
#define INIT_STR(NAME, LITERAL) \
|
#define INIT_STR(NAME, LITERAL) \
|
||||||
._ ## NAME = _PyASCIIObject_INIT(LITERAL)
|
._py_ ## NAME = _PyASCIIObject_INIT(LITERAL)
|
||||||
#define INIT_ID(NAME) \
|
#define INIT_ID(NAME) \
|
||||||
._ ## NAME = _PyASCIIObject_INIT(#NAME)
|
._py_ ## NAME = _PyASCIIObject_INIT(#NAME)
|
||||||
#define _PyUnicode_LATIN1_INIT(LITERAL, UTF8) \
|
#define _PyUnicode_LATIN1_INIT(LITERAL, UTF8) \
|
||||||
{ \
|
{ \
|
||||||
._latin1 = { \
|
._latin1 = { \
|
||||||
|
|
|
@ -755,6 +755,7 @@ extern "C" {
|
||||||
INIT_ID(_showwarnmsg), \
|
INIT_ID(_showwarnmsg), \
|
||||||
INIT_ID(_shutdown), \
|
INIT_ID(_shutdown), \
|
||||||
INIT_ID(_slotnames), \
|
INIT_ID(_slotnames), \
|
||||||
|
INIT_ID(_strptime_datetime), \
|
||||||
INIT_ID(_swappedbytes_), \
|
INIT_ID(_swappedbytes_), \
|
||||||
INIT_ID(_type_), \
|
INIT_ID(_type_), \
|
||||||
INIT_ID(_uninitialized_submodules), \
|
INIT_ID(_uninitialized_submodules), \
|
||||||
|
@ -773,6 +774,7 @@ extern "C" {
|
||||||
INIT_ID(argdefs), \
|
INIT_ID(argdefs), \
|
||||||
INIT_ID(arguments), \
|
INIT_ID(arguments), \
|
||||||
INIT_ID(argv), \
|
INIT_ID(argv), \
|
||||||
|
INIT_ID(as_integer_ratio), \
|
||||||
INIT_ID(attribute), \
|
INIT_ID(attribute), \
|
||||||
INIT_ID(authorizer_callback), \
|
INIT_ID(authorizer_callback), \
|
||||||
INIT_ID(b), \
|
INIT_ID(b), \
|
||||||
|
@ -912,6 +914,8 @@ extern "C" {
|
||||||
INIT_ID(frequency), \
|
INIT_ID(frequency), \
|
||||||
INIT_ID(from_param), \
|
INIT_ID(from_param), \
|
||||||
INIT_ID(fromlist), \
|
INIT_ID(fromlist), \
|
||||||
|
INIT_ID(fromtimestamp), \
|
||||||
|
INIT_ID(fromutc), \
|
||||||
INIT_ID(fset), \
|
INIT_ID(fset), \
|
||||||
INIT_ID(func), \
|
INIT_ID(func), \
|
||||||
INIT_ID(future), \
|
INIT_ID(future), \
|
||||||
|
@ -957,6 +961,7 @@ extern "C" {
|
||||||
INIT_ID(intersection), \
|
INIT_ID(intersection), \
|
||||||
INIT_ID(isatty), \
|
INIT_ID(isatty), \
|
||||||
INIT_ID(isinstance), \
|
INIT_ID(isinstance), \
|
||||||
|
INIT_ID(isoformat), \
|
||||||
INIT_ID(isolation_level), \
|
INIT_ID(isolation_level), \
|
||||||
INIT_ID(istext), \
|
INIT_ID(istext), \
|
||||||
INIT_ID(item), \
|
INIT_ID(item), \
|
||||||
|
@ -1145,6 +1150,7 @@ extern "C" {
|
||||||
INIT_ID(step), \
|
INIT_ID(step), \
|
||||||
INIT_ID(store_name), \
|
INIT_ID(store_name), \
|
||||||
INIT_ID(strategy), \
|
INIT_ID(strategy), \
|
||||||
|
INIT_ID(strftime), \
|
||||||
INIT_ID(strict), \
|
INIT_ID(strict), \
|
||||||
INIT_ID(strict_mode), \
|
INIT_ID(strict_mode), \
|
||||||
INIT_ID(string), \
|
INIT_ID(string), \
|
||||||
|
@ -1167,6 +1173,7 @@ extern "C" {
|
||||||
INIT_ID(throw), \
|
INIT_ID(throw), \
|
||||||
INIT_ID(timeout), \
|
INIT_ID(timeout), \
|
||||||
INIT_ID(times), \
|
INIT_ID(times), \
|
||||||
|
INIT_ID(timetuple), \
|
||||||
INIT_ID(top), \
|
INIT_ID(top), \
|
||||||
INIT_ID(trace_callback), \
|
INIT_ID(trace_callback), \
|
||||||
INIT_ID(traceback), \
|
INIT_ID(traceback), \
|
||||||
|
@ -1178,6 +1185,7 @@ extern "C" {
|
||||||
INIT_ID(txt), \
|
INIT_ID(txt), \
|
||||||
INIT_ID(type), \
|
INIT_ID(type), \
|
||||||
INIT_ID(tz), \
|
INIT_ID(tz), \
|
||||||
|
INIT_ID(tzname), \
|
||||||
INIT_ID(uid), \
|
INIT_ID(uid), \
|
||||||
INIT_ID(unlink), \
|
INIT_ID(unlink), \
|
||||||
INIT_ID(unraisablehook), \
|
INIT_ID(unraisablehook), \
|
||||||
|
@ -1860,6 +1868,8 @@ _PyUnicode_InitStaticStrings(void) {
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(_slotnames);
|
string = &_Py_ID(_slotnames);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
|
string = &_Py_ID(_strptime_datetime);
|
||||||
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(_swappedbytes_);
|
string = &_Py_ID(_swappedbytes_);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(_type_);
|
string = &_Py_ID(_type_);
|
||||||
|
@ -1896,6 +1906,8 @@ _PyUnicode_InitStaticStrings(void) {
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(argv);
|
string = &_Py_ID(argv);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
|
string = &_Py_ID(as_integer_ratio);
|
||||||
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(attribute);
|
string = &_Py_ID(attribute);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(authorizer_callback);
|
string = &_Py_ID(authorizer_callback);
|
||||||
|
@ -2174,6 +2186,10 @@ _PyUnicode_InitStaticStrings(void) {
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(fromlist);
|
string = &_Py_ID(fromlist);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
|
string = &_Py_ID(fromtimestamp);
|
||||||
|
PyUnicode_InternInPlace(&string);
|
||||||
|
string = &_Py_ID(fromutc);
|
||||||
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(fset);
|
string = &_Py_ID(fset);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(func);
|
string = &_Py_ID(func);
|
||||||
|
@ -2264,6 +2280,8 @@ _PyUnicode_InitStaticStrings(void) {
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(isinstance);
|
string = &_Py_ID(isinstance);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
|
string = &_Py_ID(isoformat);
|
||||||
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(isolation_level);
|
string = &_Py_ID(isolation_level);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(istext);
|
string = &_Py_ID(istext);
|
||||||
|
@ -2640,6 +2658,8 @@ _PyUnicode_InitStaticStrings(void) {
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(strategy);
|
string = &_Py_ID(strategy);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
|
string = &_Py_ID(strftime);
|
||||||
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(strict);
|
string = &_Py_ID(strict);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(strict_mode);
|
string = &_Py_ID(strict_mode);
|
||||||
|
@ -2684,6 +2704,8 @@ _PyUnicode_InitStaticStrings(void) {
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(times);
|
string = &_Py_ID(times);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
|
string = &_Py_ID(timetuple);
|
||||||
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(top);
|
string = &_Py_ID(top);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(trace_callback);
|
string = &_Py_ID(trace_callback);
|
||||||
|
@ -2706,6 +2728,8 @@ _PyUnicode_InitStaticStrings(void) {
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(tz);
|
string = &_Py_ID(tz);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
|
string = &_Py_ID(tzname);
|
||||||
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(uid);
|
string = &_Py_ID(uid);
|
||||||
PyUnicode_InternInPlace(&string);
|
PyUnicode_InternInPlace(&string);
|
||||||
string = &_Py_ID(unlink);
|
string = &_Py_ID(unlink);
|
||||||
|
@ -5691,6 +5715,10 @@ _PyStaticObjects_CheckRefcnt(void) {
|
||||||
_PyObject_Dump((PyObject *)&_Py_ID(_slotnames));
|
_PyObject_Dump((PyObject *)&_Py_ID(_slotnames));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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) {
|
if (Py_REFCNT((PyObject *)&_Py_ID(_swappedbytes_)) < _PyObject_IMMORTAL_REFCNT) {
|
||||||
_PyObject_Dump((PyObject *)&_Py_ID(_swappedbytes_));
|
_PyObject_Dump((PyObject *)&_Py_ID(_swappedbytes_));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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));
|
_PyObject_Dump((PyObject *)&_Py_ID(argv));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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) {
|
if (Py_REFCNT((PyObject *)&_Py_ID(attribute)) < _PyObject_IMMORTAL_REFCNT) {
|
||||||
_PyObject_Dump((PyObject *)&_Py_ID(attribute));
|
_PyObject_Dump((PyObject *)&_Py_ID(attribute));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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));
|
_PyObject_Dump((PyObject *)&_Py_ID(fromlist));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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) {
|
if (Py_REFCNT((PyObject *)&_Py_ID(fset)) < _PyObject_IMMORTAL_REFCNT) {
|
||||||
_PyObject_Dump((PyObject *)&_Py_ID(fset));
|
_PyObject_Dump((PyObject *)&_Py_ID(fset));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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));
|
_PyObject_Dump((PyObject *)&_Py_ID(isinstance));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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) {
|
if (Py_REFCNT((PyObject *)&_Py_ID(isolation_level)) < _PyObject_IMMORTAL_REFCNT) {
|
||||||
_PyObject_Dump((PyObject *)&_Py_ID(isolation_level));
|
_PyObject_Dump((PyObject *)&_Py_ID(isolation_level));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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));
|
_PyObject_Dump((PyObject *)&_Py_ID(strategy));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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) {
|
if (Py_REFCNT((PyObject *)&_Py_ID(strict)) < _PyObject_IMMORTAL_REFCNT) {
|
||||||
_PyObject_Dump((PyObject *)&_Py_ID(strict));
|
_PyObject_Dump((PyObject *)&_Py_ID(strict));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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));
|
_PyObject_Dump((PyObject *)&_Py_ID(times));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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) {
|
if (Py_REFCNT((PyObject *)&_Py_ID(top)) < _PyObject_IMMORTAL_REFCNT) {
|
||||||
_PyObject_Dump((PyObject *)&_Py_ID(top));
|
_PyObject_Dump((PyObject *)&_Py_ID(top));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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));
|
_PyObject_Dump((PyObject *)&_Py_ID(tz));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
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) {
|
if (Py_REFCNT((PyObject *)&_Py_ID(uid)) < _PyObject_IMMORTAL_REFCNT) {
|
||||||
_PyObject_Dump((PyObject *)&_Py_ID(uid));
|
_PyObject_Dump((PyObject *)&_Py_ID(uid));
|
||||||
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#ifndef Py_BUILD_CORE_BUILTIN
|
#ifndef Py_BUILD_CORE_BUILTIN
|
||||||
# define Py_BUILD_CORE_MODULE 1
|
# define Py_BUILD_CORE_MODULE 1
|
||||||
#endif
|
#endif
|
||||||
#define NEEDS_PY_IDENTIFIER
|
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "pycore_long.h" // _PyLong_GetOne()
|
#include "pycore_long.h" // _PyLong_GetOne()
|
||||||
|
@ -141,10 +140,6 @@ static PyTypeObject PyDateTime_TimeZoneType;
|
||||||
|
|
||||||
static int check_tzinfo_subclass(PyObject *p);
|
static int check_tzinfo_subclass(PyObject *p);
|
||||||
|
|
||||||
_Py_IDENTIFIER(as_integer_ratio);
|
|
||||||
_Py_IDENTIFIER(fromutc);
|
|
||||||
_Py_IDENTIFIER(isoformat);
|
|
||||||
_Py_IDENTIFIER(strftime);
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------
|
||||||
* Math utilities.
|
* Math utilities.
|
||||||
|
@ -1323,8 +1318,6 @@ static PyObject *
|
||||||
call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
|
call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
|
||||||
{
|
{
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
_Py_IDENTIFIER(tzname);
|
|
||||||
|
|
||||||
assert(tzinfo != NULL);
|
assert(tzinfo != NULL);
|
||||||
assert(check_tzinfo_subclass(tzinfo) >= 0);
|
assert(check_tzinfo_subclass(tzinfo) >= 0);
|
||||||
assert(tzinfoarg != NULL);
|
assert(tzinfoarg != NULL);
|
||||||
|
@ -1332,7 +1325,7 @@ call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
|
||||||
if (tzinfo == Py_None)
|
if (tzinfo == Py_None)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
result = _PyObject_CallMethodIdOneArg(tzinfo, &PyId_tzname, tzinfoarg);
|
result = PyObject_CallMethodOneArg(tzinfo, &_Py_ID(tzname), tzinfoarg);
|
||||||
|
|
||||||
if (result == NULL || result == Py_None)
|
if (result == NULL || result == Py_None)
|
||||||
return result;
|
return result;
|
||||||
|
@ -1515,7 +1508,7 @@ make_somezreplacement(PyObject *object, char *sep, PyObject *tzinfoarg)
|
||||||
if (tzinfo == Py_None || tzinfo == NULL) {
|
if (tzinfo == Py_None || tzinfo == NULL) {
|
||||||
return PyBytes_FromStringAndSize(NULL, 0);
|
return PyBytes_FromStringAndSize(NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(tzinfoarg != NULL);
|
assert(tzinfoarg != NULL);
|
||||||
if (format_utcoffset(buf,
|
if (format_utcoffset(buf,
|
||||||
sizeof(buf),
|
sizeof(buf),
|
||||||
|
@ -1523,7 +1516,7 @@ make_somezreplacement(PyObject *object, char *sep, PyObject *tzinfoarg)
|
||||||
tzinfo,
|
tzinfo,
|
||||||
tzinfoarg) < 0)
|
tzinfoarg) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PyBytes_FromStringAndSize(buf, strlen(buf));
|
return PyBytes_FromStringAndSize(buf, strlen(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1533,7 +1526,6 @@ make_Zreplacement(PyObject *object, PyObject *tzinfoarg)
|
||||||
PyObject *temp;
|
PyObject *temp;
|
||||||
PyObject *tzinfo = get_tzinfo_member(object);
|
PyObject *tzinfo = get_tzinfo_member(object);
|
||||||
PyObject *Zreplacement = PyUnicode_FromStringAndSize(NULL, 0);
|
PyObject *Zreplacement = PyUnicode_FromStringAndSize(NULL, 0);
|
||||||
_Py_IDENTIFIER(replace);
|
|
||||||
|
|
||||||
if (Zreplacement == NULL)
|
if (Zreplacement == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1555,7 +1547,7 @@ make_Zreplacement(PyObject *object, PyObject *tzinfoarg)
|
||||||
* strftime doesn't treat them as format codes.
|
* strftime doesn't treat them as format codes.
|
||||||
*/
|
*/
|
||||||
Py_DECREF(Zreplacement);
|
Py_DECREF(Zreplacement);
|
||||||
Zreplacement = _PyObject_CallMethodId(temp, &PyId_replace, "ss", "%", "%%");
|
Zreplacement = PyObject_CallMethod(temp, "replace", "ss", "%", "%%");
|
||||||
Py_DECREF(temp);
|
Py_DECREF(temp);
|
||||||
if (Zreplacement == NULL)
|
if (Zreplacement == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2019,7 +2011,7 @@ get_float_as_integer_ratio(PyObject *floatobj)
|
||||||
PyObject *ratio;
|
PyObject *ratio;
|
||||||
|
|
||||||
assert(floatobj && PyFloat_Check(floatobj));
|
assert(floatobj && PyFloat_Check(floatobj));
|
||||||
ratio = _PyObject_CallMethodIdNoArgs(floatobj, &PyId_as_integer_ratio);
|
ratio = PyObject_CallMethodNoArgs(floatobj, &_Py_ID(as_integer_ratio));
|
||||||
if (ratio == NULL) {
|
if (ratio == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2982,8 +2974,6 @@ date_today(PyObject *cls, PyObject *dummy)
|
||||||
{
|
{
|
||||||
PyObject *time;
|
PyObject *time;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
_Py_IDENTIFIER(fromtimestamp);
|
|
||||||
|
|
||||||
time = time_time();
|
time = time_time();
|
||||||
if (time == NULL)
|
if (time == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2994,7 +2984,7 @@ date_today(PyObject *cls, PyObject *dummy)
|
||||||
* time.time() delivers; if someone were gonzo about optimization,
|
* time.time() delivers; if someone were gonzo about optimization,
|
||||||
* date.today() could get away with plain C time().
|
* date.today() could get away with plain C time().
|
||||||
*/
|
*/
|
||||||
result = _PyObject_CallMethodIdOneArg(cls, &PyId_fromtimestamp, time);
|
result = PyObject_CallMethodOneArg(cls, &_Py_ID(fromtimestamp), time);
|
||||||
Py_DECREF(time);
|
Py_DECREF(time);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3245,7 +3235,7 @@ date_isoformat(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
|
||||||
static PyObject *
|
static PyObject *
|
||||||
date_str(PyDateTime_Date *self)
|
date_str(PyDateTime_Date *self)
|
||||||
{
|
{
|
||||||
return _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_isoformat);
|
return PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(isoformat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3264,14 +3254,13 @@ date_strftime(PyDateTime_Date *self, PyObject *args, PyObject *kw)
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
PyObject *tuple;
|
PyObject *tuple;
|
||||||
PyObject *format;
|
PyObject *format;
|
||||||
_Py_IDENTIFIER(timetuple);
|
|
||||||
static char *keywords[] = {"format", NULL};
|
static char *keywords[] = {"format", NULL};
|
||||||
|
|
||||||
if (! PyArg_ParseTupleAndKeywords(args, kw, "U:strftime", keywords,
|
if (! PyArg_ParseTupleAndKeywords(args, kw, "U:strftime", keywords,
|
||||||
&format))
|
&format))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
tuple = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_timetuple);
|
tuple = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(timetuple));
|
||||||
if (tuple == NULL)
|
if (tuple == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
result = wrap_strftime((PyObject *)self, format, tuple,
|
result = wrap_strftime((PyObject *)self, format, tuple,
|
||||||
|
@ -3292,7 +3281,7 @@ date_format(PyDateTime_Date *self, PyObject *args)
|
||||||
if (PyUnicode_GetLength(format) == 0)
|
if (PyUnicode_GetLength(format) == 0)
|
||||||
return PyObject_Str((PyObject *)self);
|
return PyObject_Str((PyObject *)self);
|
||||||
|
|
||||||
return _PyObject_CallMethodIdOneArg((PyObject *)self, &PyId_strftime,
|
return PyObject_CallMethodOneArg((PyObject *)self, &_Py_ID(strftime),
|
||||||
format);
|
format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3821,9 +3810,8 @@ tzinfo_reduce(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||||
{
|
{
|
||||||
PyObject *args, *state;
|
PyObject *args, *state;
|
||||||
PyObject *getinitargs;
|
PyObject *getinitargs;
|
||||||
_Py_IDENTIFIER(__getinitargs__);
|
|
||||||
|
|
||||||
if (_PyObject_LookupAttrId(self, &PyId___getinitargs__, &getinitargs) < 0) {
|
if (_PyObject_LookupAttr(self, &_Py_ID(__getinitargs__), &getinitargs) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (getinitargs != NULL) {
|
if (getinitargs != NULL) {
|
||||||
|
@ -4368,7 +4356,7 @@ time_repr(PyDateTime_Time *self)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_str(PyDateTime_Time *self)
|
time_str(PyDateTime_Time *self)
|
||||||
{
|
{
|
||||||
return _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_isoformat);
|
return PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(isoformat));
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -5170,7 +5158,9 @@ datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz)
|
||||||
tz);
|
tz);
|
||||||
if (self != NULL && tz != Py_None) {
|
if (self != NULL && tz != Py_None) {
|
||||||
/* Convert UTC to tzinfo's zone. */
|
/* Convert UTC to tzinfo's zone. */
|
||||||
self = _PyObject_CallMethodId(tz, &PyId_fromutc, "N", self);
|
PyObject *res = PyObject_CallMethodOneArg(tz, &_Py_ID(fromutc), self);
|
||||||
|
Py_DECREF(self);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -5206,7 +5196,9 @@ datetime_fromtimestamp(PyObject *cls, PyObject *args, PyObject *kw)
|
||||||
tzinfo);
|
tzinfo);
|
||||||
if (self != NULL && tzinfo != Py_None) {
|
if (self != NULL && tzinfo != Py_None) {
|
||||||
/* Convert UTC to tzinfo's zone. */
|
/* Convert UTC to tzinfo's zone. */
|
||||||
self = _PyObject_CallMethodId(tzinfo, &PyId_fromutc, "N", self);
|
PyObject *res = PyObject_CallMethodOneArg(tzinfo, &_Py_ID(fromutc), self);
|
||||||
|
Py_DECREF(self);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -5230,7 +5222,6 @@ datetime_strptime(PyObject *cls, PyObject *args)
|
||||||
{
|
{
|
||||||
static PyObject *module = NULL;
|
static PyObject *module = NULL;
|
||||||
PyObject *string, *format;
|
PyObject *string, *format;
|
||||||
_Py_IDENTIFIER(_strptime_datetime);
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "UU:strptime", &string, &format))
|
if (!PyArg_ParseTuple(args, "UU:strptime", &string, &format))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -5240,7 +5231,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
|
||||||
if (module == NULL)
|
if (module == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return _PyObject_CallMethodIdObjArgs(module, &PyId__strptime_datetime,
|
return PyObject_CallMethodObjArgs(module, &_Py_ID(_strptime_datetime),
|
||||||
cls, string, format, NULL);
|
cls, string, format, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5747,7 +5738,14 @@ datetime_repr(PyDateTime_DateTime *self)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
datetime_str(PyDateTime_DateTime *self)
|
datetime_str(PyDateTime_DateTime *self)
|
||||||
{
|
{
|
||||||
return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "s", " ");
|
PyObject *space = PyUnicode_FromString(" ");
|
||||||
|
if (space == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
PyObject *res = PyObject_CallMethodOneArg((PyObject *)self,
|
||||||
|
&_Py_ID(isoformat), space);
|
||||||
|
Py_DECREF(space);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -6301,7 +6299,7 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
|
||||||
|
|
||||||
temp = (PyObject *)result;
|
temp = (PyObject *)result;
|
||||||
result = (PyDateTime_DateTime *)
|
result = (PyDateTime_DateTime *)
|
||||||
_PyObject_CallMethodIdOneArg(tzinfo, &PyId_fromutc, temp);
|
PyObject_CallMethodOneArg(tzinfo, &_Py_ID(fromutc), temp);
|
||||||
Py_DECREF(temp);
|
Py_DECREF(temp);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
#undef Py_BUILD_CORE_MODULE
|
#undef Py_BUILD_CORE_MODULE
|
||||||
#undef Py_BUILD_CORE_BUILTIN
|
#undef Py_BUILD_CORE_BUILTIN
|
||||||
#define NEEDS_PY_IDENTIFIER
|
|
||||||
|
|
||||||
/* Always enable assertions */
|
/* Always enable assertions */
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
|
@ -3358,7 +3357,6 @@ test_pytime_object_to_timespec(PyObject *self, PyObject *args)
|
||||||
static void
|
static void
|
||||||
slot_tp_del(PyObject *self)
|
slot_tp_del(PyObject *self)
|
||||||
{
|
{
|
||||||
_Py_IDENTIFIER(__tp_del__);
|
|
||||||
PyObject *del, *res;
|
PyObject *del, *res;
|
||||||
PyObject *error_type, *error_value, *error_traceback;
|
PyObject *error_type, *error_value, *error_traceback;
|
||||||
|
|
||||||
|
@ -3369,15 +3367,20 @@ slot_tp_del(PyObject *self)
|
||||||
/* Save the current exception, if any. */
|
/* Save the current exception, if any. */
|
||||||
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
||||||
|
|
||||||
|
PyObject *tp_del = PyUnicode_InternFromString("__tp_del__");
|
||||||
|
if (tp_del == NULL) {
|
||||||
|
PyErr_WriteUnraisable(NULL);
|
||||||
|
PyErr_Restore(error_type, error_value, error_traceback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
/* Execute __del__ method, if any. */
|
/* Execute __del__ method, if any. */
|
||||||
del = _PyObject_LookupSpecialId(self, &PyId___tp_del__);
|
del = _PyType_Lookup(Py_TYPE(self), tp_del);
|
||||||
if (del != NULL) {
|
if (del != NULL) {
|
||||||
res = PyObject_CallNoArgs(del);
|
res = PyObject_CallOneArg(del, self);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
PyErr_WriteUnraisable(del);
|
PyErr_WriteUnraisable(del);
|
||||||
else
|
else
|
||||||
Py_DECREF(res);
|
Py_DECREF(res);
|
||||||
Py_DECREF(del);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore the saved exception. */
|
/* Restore the saved exception. */
|
||||||
|
@ -4699,7 +4702,6 @@ dict_get_version(PyObject *self, PyObject *args)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
raise_SIGINT_then_send_None(PyObject *self, PyObject *args)
|
raise_SIGINT_then_send_None(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
_Py_IDENTIFIER(send);
|
|
||||||
PyGenObject *gen;
|
PyGenObject *gen;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O!", &PyGen_Type, &gen))
|
if (!PyArg_ParseTuple(args, "O!", &PyGen_Type, &gen))
|
||||||
|
@ -4716,7 +4718,7 @@ raise_SIGINT_then_send_None(PyObject *self, PyObject *args)
|
||||||
because we check for signals before every bytecode operation.
|
because we check for signals before every bytecode operation.
|
||||||
*/
|
*/
|
||||||
raise(SIGINT);
|
raise(SIGINT);
|
||||||
return _PyObject_CallMethodIdOneArg((PyObject *)gen, &PyId_send, Py_None);
|
return PyObject_CallMethod((PyObject *)gen, "send", "O", Py_None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#ifndef Py_BUILD_CORE_BUILTIN
|
#ifndef Py_BUILD_CORE_BUILTIN
|
||||||
# define Py_BUILD_CORE_MODULE 1
|
# define Py_BUILD_CORE_MODULE 1
|
||||||
#endif
|
#endif
|
||||||
#define NEEDS_PY_IDENTIFIER
|
|
||||||
|
|
||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
@ -542,9 +541,7 @@ oss_self(PyObject *self, PyObject *unused)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
oss_exit(PyObject *self, PyObject *unused)
|
oss_exit(PyObject *self, PyObject *unused)
|
||||||
{
|
{
|
||||||
_Py_IDENTIFIER(close);
|
PyObject *ret = PyObject_CallMethod(self, "close", NULL);
|
||||||
|
|
||||||
PyObject *ret = _PyObject_CallMethodIdNoArgs(self, &PyId_close);
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
|
|
|
@ -172,9 +172,7 @@ static FNFCIGETTEMPFILE(cb_gettempfile)
|
||||||
static FNFCISTATUS(cb_status)
|
static FNFCISTATUS(cb_status)
|
||||||
{
|
{
|
||||||
if (pv) {
|
if (pv) {
|
||||||
_Py_IDENTIFIER(status);
|
PyObject *result = PyObject_CallMethod(pv, "status", "iii", typeStatus, cb1, cb2);
|
||||||
|
|
||||||
PyObject *result = _PyObject_CallMethodId(pv, &PyId_status, "iii", typeStatus, cb1, cb2);
|
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
|
@ -185,9 +183,7 @@ static FNFCISTATUS(cb_status)
|
||||||
static FNFCIGETNEXTCABINET(cb_getnextcabinet)
|
static FNFCIGETNEXTCABINET(cb_getnextcabinet)
|
||||||
{
|
{
|
||||||
if (pv) {
|
if (pv) {
|
||||||
_Py_IDENTIFIER(getnextcabinet);
|
PyObject *result = PyObject_CallMethod(pv, "getnextcabinet", "i", pccab->iCab);
|
||||||
|
|
||||||
PyObject *result = _PyObject_CallMethodId(pv, &PyId_getnextcabinet, "i", pccab->iCab);
|
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
if (!PyBytes_Check(result)) {
|
if (!PyBytes_Check(result)) {
|
||||||
|
|
Loading…
Reference in New Issue