summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--Modules/_datetimemodule.c56
-rw-r--r--Modules/_testcapimodule.c16
-rw-r--r--Modules/ossaudiodev.c5
-rw-r--r--PC/_msi.c8
7 files changed, 110 insertions, 53 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");
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index d86418a..15170b3 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -10,7 +10,6 @@
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif
-#define NEEDS_PY_IDENTIFIER
#include "Python.h"
#include "pycore_long.h" // _PyLong_GetOne()
@@ -141,10 +140,6 @@ static PyTypeObject PyDateTime_TimeZoneType;
static int check_tzinfo_subclass(PyObject *p);
-_Py_IDENTIFIER(as_integer_ratio);
-_Py_IDENTIFIER(fromutc);
-_Py_IDENTIFIER(isoformat);
-_Py_IDENTIFIER(strftime);
/* ---------------------------------------------------------------------------
* Math utilities.
@@ -1323,8 +1318,6 @@ static PyObject *
call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
{
PyObject *result;
- _Py_IDENTIFIER(tzname);
-
assert(tzinfo != NULL);
assert(check_tzinfo_subclass(tzinfo) >= 0);
assert(tzinfoarg != NULL);
@@ -1332,7 +1325,7 @@ call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
if (tzinfo == Py_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)
return result;
@@ -1515,7 +1508,7 @@ make_somezreplacement(PyObject *object, char *sep, PyObject *tzinfoarg)
if (tzinfo == Py_None || tzinfo == NULL) {
return PyBytes_FromStringAndSize(NULL, 0);
}
-
+
assert(tzinfoarg != NULL);
if (format_utcoffset(buf,
sizeof(buf),
@@ -1523,7 +1516,7 @@ make_somezreplacement(PyObject *object, char *sep, PyObject *tzinfoarg)
tzinfo,
tzinfoarg) < 0)
return NULL;
-
+
return PyBytes_FromStringAndSize(buf, strlen(buf));
}
@@ -1533,7 +1526,6 @@ make_Zreplacement(PyObject *object, PyObject *tzinfoarg)
PyObject *temp;
PyObject *tzinfo = get_tzinfo_member(object);
PyObject *Zreplacement = PyUnicode_FromStringAndSize(NULL, 0);
- _Py_IDENTIFIER(replace);
if (Zreplacement == NULL)
return NULL;
@@ -1555,7 +1547,7 @@ make_Zreplacement(PyObject *object, PyObject *tzinfoarg)
* strftime doesn't treat them as format codes.
*/
Py_DECREF(Zreplacement);
- Zreplacement = _PyObject_CallMethodId(temp, &PyId_replace, "ss", "%", "%%");
+ Zreplacement = PyObject_CallMethod(temp, "replace", "ss", "%", "%%");
Py_DECREF(temp);
if (Zreplacement == NULL)
return NULL;
@@ -2019,7 +2011,7 @@ get_float_as_integer_ratio(PyObject *floatobj)
PyObject *ratio;
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) {
return NULL;
}
@@ -2982,8 +2974,6 @@ date_today(PyObject *cls, PyObject *dummy)
{
PyObject *time;
PyObject *result;
- _Py_IDENTIFIER(fromtimestamp);
-
time = time_time();
if (time == NULL)
return NULL;
@@ -2994,7 +2984,7 @@ date_today(PyObject *cls, PyObject *dummy)
* time.time() delivers; if someone were gonzo about optimization,
* 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);
return result;
}
@@ -3245,7 +3235,7 @@ date_isoformat(PyDateTime_Date *self, PyObject *Py_UNUSED(ignored))
static PyObject *
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 *tuple;
PyObject *format;
- _Py_IDENTIFIER(timetuple);
static char *keywords[] = {"format", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "U:strftime", keywords,
&format))
return NULL;
- tuple = _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_timetuple);
+ tuple = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(timetuple));
if (tuple == NULL)
return NULL;
result = wrap_strftime((PyObject *)self, format, tuple,
@@ -3292,7 +3281,7 @@ date_format(PyDateTime_Date *self, PyObject *args)
if (PyUnicode_GetLength(format) == 0)
return PyObject_Str((PyObject *)self);
- return _PyObject_CallMethodIdOneArg((PyObject *)self, &PyId_strftime,
+ return PyObject_CallMethodOneArg((PyObject *)self, &_Py_ID(strftime),
format);
}
@@ -3821,9 +3810,8 @@ tzinfo_reduce(PyObject *self, PyObject *Py_UNUSED(ignored))
{
PyObject *args, *state;
PyObject *getinitargs;
- _Py_IDENTIFIER(__getinitargs__);
- if (_PyObject_LookupAttrId(self, &PyId___getinitargs__, &getinitargs) < 0) {
+ if (_PyObject_LookupAttr(self, &_Py_ID(__getinitargs__), &getinitargs) < 0) {
return NULL;
}
if (getinitargs != NULL) {
@@ -4368,7 +4356,7 @@ time_repr(PyDateTime_Time *self)
static PyObject *
time_str(PyDateTime_Time *self)
{
- return _PyObject_CallMethodIdNoArgs((PyObject *)self, &PyId_isoformat);
+ return PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(isoformat));
}
static PyObject *
@@ -5170,7 +5158,9 @@ datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz)
tz);
if (self != NULL && tz != Py_None) {
/* 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;
}
@@ -5206,7 +5196,9 @@ datetime_fromtimestamp(PyObject *cls, PyObject *args, PyObject *kw)
tzinfo);
if (self != NULL && tzinfo != Py_None) {
/* 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;
}
@@ -5230,7 +5222,6 @@ datetime_strptime(PyObject *cls, PyObject *args)
{
static PyObject *module = NULL;
PyObject *string, *format;
- _Py_IDENTIFIER(_strptime_datetime);
if (!PyArg_ParseTuple(args, "UU:strptime", &string, &format))
return NULL;
@@ -5240,7 +5231,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
if (module == NULL)
return NULL;
}
- return _PyObject_CallMethodIdObjArgs(module, &PyId__strptime_datetime,
+ return PyObject_CallMethodObjArgs(module, &_Py_ID(_strptime_datetime),
cls, string, format, NULL);
}
@@ -5747,7 +5738,14 @@ datetime_repr(PyDateTime_DateTime *self)
static PyObject *
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 *
@@ -6301,7 +6299,7 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
temp = (PyObject *)result;
result = (PyDateTime_DateTime *)
- _PyObject_CallMethodIdOneArg(tzinfo, &PyId_fromutc, temp);
+ PyObject_CallMethodOneArg(tzinfo, &_Py_ID(fromutc), temp);
Py_DECREF(temp);
return result;
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 66d1d47..0e09c97 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -13,7 +13,6 @@
#undef Py_BUILD_CORE_MODULE
#undef Py_BUILD_CORE_BUILTIN
-#define NEEDS_PY_IDENTIFIER
/* Always enable assertions */
#undef NDEBUG
@@ -3358,7 +3357,6 @@ test_pytime_object_to_timespec(PyObject *self, PyObject *args)
static void
slot_tp_del(PyObject *self)
{
- _Py_IDENTIFIER(__tp_del__);
PyObject *del, *res;
PyObject *error_type, *error_value, *error_traceback;
@@ -3369,15 +3367,20 @@ slot_tp_del(PyObject *self)
/* Save the current exception, if any. */
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. */
- del = _PyObject_LookupSpecialId(self, &PyId___tp_del__);
+ del = _PyType_Lookup(Py_TYPE(self), tp_del);
if (del != NULL) {
- res = PyObject_CallNoArgs(del);
+ res = PyObject_CallOneArg(del, self);
if (res == NULL)
PyErr_WriteUnraisable(del);
else
Py_DECREF(res);
- Py_DECREF(del);
}
/* Restore the saved exception. */
@@ -4699,7 +4702,6 @@ dict_get_version(PyObject *self, PyObject *args)
static PyObject *
raise_SIGINT_then_send_None(PyObject *self, PyObject *args)
{
- _Py_IDENTIFIER(send);
PyGenObject *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.
*/
raise(SIGINT);
- return _PyObject_CallMethodIdOneArg((PyObject *)gen, &PyId_send, Py_None);
+ return PyObject_CallMethod((PyObject *)gen, "send", "O", Py_None);
}
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 0568b6d..f1c126f 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -20,7 +20,6 @@
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif
-#define NEEDS_PY_IDENTIFIER
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -542,9 +541,7 @@ oss_self(PyObject *self, PyObject *unused)
static PyObject *
oss_exit(PyObject *self, PyObject *unused)
{
- _Py_IDENTIFIER(close);
-
- PyObject *ret = _PyObject_CallMethodIdNoArgs(self, &PyId_close);
+ PyObject *ret = PyObject_CallMethod(self, "close", NULL);
if (!ret)
return NULL;
Py_DECREF(ret);
diff --git a/PC/_msi.c b/PC/_msi.c
index 3686b9b..01f7fea 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -172,9 +172,7 @@ static FNFCIGETTEMPFILE(cb_gettempfile)
static FNFCISTATUS(cb_status)
{
if (pv) {
- _Py_IDENTIFIER(status);
-
- PyObject *result = _PyObject_CallMethodId(pv, &PyId_status, "iii", typeStatus, cb1, cb2);
+ PyObject *result = PyObject_CallMethod(pv, "status", "iii", typeStatus, cb1, cb2);
if (result == NULL)
return -1;
Py_DECREF(result);
@@ -185,9 +183,7 @@ static FNFCISTATUS(cb_status)
static FNFCIGETNEXTCABINET(cb_getnextcabinet)
{
if (pv) {
- _Py_IDENTIFIER(getnextcabinet);
-
- PyObject *result = _PyObject_CallMethodId(pv, &PyId_getnextcabinet, "i", pccab->iCab);
+ PyObject *result = PyObject_CallMethod(pv, "getnextcabinet", "i", pccab->iCab);
if (result == NULL)
return -1;
if (!PyBytes_Check(result)) {