summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-07 22:38:15 (GMT)
committerGitHub <noreply@github.com>2020-04-07 22:38:15 (GMT)
commit9205520d8c43488696d66cbdd9aefbb21871c508 (patch)
tree6c6d03828fddd763f261d89a9afef18b109c0d3d /Modules
parentf9dd51e7db27d04e0b716d41a2804d5acbf145d1 (diff)
downloadcpython-9205520d8c43488696d66cbdd9aefbb21871c508.zip
cpython-9205520d8c43488696d66cbdd9aefbb21871c508.tar.gz
cpython-9205520d8c43488696d66cbdd9aefbb21871c508.tar.bz2
bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379)
The PyObject_NEW() macro becomes an alias to the PyObject_New() macro, and the PyObject_NEW_VAR() macro becomes an alias to the PyObject_NewVar() macro, to hide implementation details. They no longer access directly the PyTypeObject.tp_basicsize member. Exclude _PyObject_SIZE() and _PyObject_VAR_SIZE() macros from the limited C API. Replace PyObject_NEW() with PyObject_New() and replace PyObject_NEW_VAR() with PyObject_NewVar().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_curses_panel.c2
-rw-r--r--Modules/_cursesmodule.c2
-rw-r--r--Modules/_sre.c8
3 files changed, 6 insertions, 6 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 77a6a14..7ca91f6 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -239,7 +239,7 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
{
PyCursesPanelObject *po;
- po = PyObject_NEW(PyCursesPanelObject,
+ po = PyObject_New(PyCursesPanelObject,
(PyTypeObject *)(_curses_panelstate_global)->PyCursesPanel_Type);
if (po == NULL) return NULL;
po->pan = pan;
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 3d16af7..ca6a89f 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -547,7 +547,7 @@ PyCursesWindow_New(WINDOW *win, const char *encoding)
encoding = "utf-8";
}
- wo = PyObject_NEW(PyCursesWindowObject, &PyCursesWindow_Type);
+ wo = PyObject_New(PyCursesWindowObject, &PyCursesWindow_Type);
if (wo == NULL) return NULL;
wo->win = win;
wo->encoding = _PyMem_Strdup(encoding);
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 52ed420..bee2e12 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -1338,7 +1338,7 @@ _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
n = PyList_GET_SIZE(code);
/* coverity[ampersand_in_size] */
- self = PyObject_NEW_VAR(PatternObject, &Pattern_Type, n);
+ self = PyObject_NewVar(PatternObject, &Pattern_Type, n);
if (!self)
return NULL;
self->weakreflist = NULL;
@@ -2327,8 +2327,8 @@ pattern_new_match(PatternObject* pattern, SRE_STATE* state, Py_ssize_t status)
/* create match object (with room for extra group marks) */
/* coverity[ampersand_in_size] */
- match = PyObject_NEW_VAR(MatchObject, &Match_Type,
- 2*(pattern->groups+1));
+ match = PyObject_NewVar(MatchObject, &Match_Type,
+ 2*(pattern->groups+1));
if (!match)
return NULL;
@@ -2468,7 +2468,7 @@ pattern_scanner(PatternObject *self, PyObject *string, Py_ssize_t pos, Py_ssize_
ScannerObject* scanner;
/* create scanner object */
- scanner = PyObject_NEW(ScannerObject, &Scanner_Type);
+ scanner = PyObject_New(ScannerObject, &Scanner_Type);
if (!scanner)
return NULL;
scanner->pattern = NULL;