summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-01-26 23:37:59 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-01-26 23:37:59 (GMT)
commit25219f596a069e8d4ed7114cd9b1bddc2a1de3b7 (patch)
treec388f0103024947127d7d4291197c591e8974e84
parent726f6902ce9c4db8dc73074ed5323a3bdeb04194 (diff)
downloadcpython-25219f596a069e8d4ed7114cd9b1bddc2a1de3b7.zip
cpython-25219f596a069e8d4ed7114cd9b1bddc2a1de3b7.tar.gz
cpython-25219f596a069e8d4ed7114cd9b1bddc2a1de3b7.tar.bz2
Issue #26146: remove useless code
obj2ast_constant() code is baesd on obj2ast_object() which has a special case for Py_None. But in practice, we don't need to have a special case for constants. Issue noticed by Joseph Jevnik on a review.
-rw-r--r--Parser/asdl_c.py7
-rw-r--r--Python/Python-ast.c7
2 files changed, 0 insertions, 14 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index a81644d..17c8517 100644
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -874,13 +874,6 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
static int obj2ast_constant(PyObject* obj, PyObject** out, PyArena* arena)
{
- if (obj == Py_None || obj == Py_True || obj == Py_False) {
- /* don't increment the reference counter, Constant uses a borrowed
- * reference, not a strong reference */
- *out = obj;
- return 0;
- }
-
if (obj) {
if (PyArena_AddPyObject(arena, obj) < 0) {
*out = NULL;
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 4dde11f..1193c7c 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -753,13 +753,6 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
static int obj2ast_constant(PyObject* obj, PyObject** out, PyArena* arena)
{
- if (obj == Py_None || obj == Py_True || obj == Py_False) {
- /* don't increment the reference counter, Constant uses a borrowed
- * reference, not a strong reference */
- *out = obj;
- return 0;
- }
-
if (obj) {
if (PyArena_AddPyObject(arena, obj) < 0) {
*out = NULL;