Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e75fc148
Commit
e75fc148
authored
Nov 07, 2013
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19514: Deduplicate some _Py_IDENTIFIER declarations.
Patch by Andrei Dorian Duma.
parent
d0293596
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
28 deletions
+18
-28
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_bisectmodule.c
Modules/_bisectmodule.c
+2
-3
Modules/_datetimemodule.c
Modules/_datetimemodule.c
+5
-14
Modules/_sqlite/connection.c
Modules/_sqlite/connection.c
+2
-3
Objects/typeobject.c
Objects/typeobject.c
+6
-8
No files found.
Misc/NEWS
View file @
e75fc148
...
...
@@ -10,6 +10,9 @@ Projected release date: 2013-11-24
Core and Builtins
-----------------
- Issue #19514: Deduplicate some _Py_IDENTIFIER declarations.
Patch by Andrei Dorian Duma.
- Issue #17936: Fix O(n**2) behaviour when adding or removing many subclasses
of a given type.
...
...
Modules/_bisectmodule.c
View file @
e75fc148
...
...
@@ -6,6 +6,8 @@ Converted to C by Dmitry Vasiliev (dima at hlabs.spb.ru).
#define PY_SSIZE_T_CLEAN
#include "Python.h"
_Py_IDENTIFIER
(
insert
);
static
Py_ssize_t
internal_bisect_right
(
PyObject
*
list
,
PyObject
*
item
,
Py_ssize_t
lo
,
Py_ssize_t
hi
)
{
...
...
@@ -90,8 +92,6 @@ insort_right(PyObject *self, PyObject *args, PyObject *kw)
if
(
PyList_Insert
(
list
,
index
,
item
)
<
0
)
return
NULL
;
}
else
{
_Py_IDENTIFIER
(
insert
);
result
=
_PyObject_CallMethodId
(
list
,
&
PyId_insert
,
"nO"
,
index
,
item
);
if
(
result
==
NULL
)
return
NULL
;
...
...
@@ -195,7 +195,6 @@ insort_left(PyObject *self, PyObject *args, PyObject *kw)
if
(
PyList_Insert
(
list
,
index
,
item
)
<
0
)
return
NULL
;
}
else
{
_Py_IDENTIFIER
(
insert
);
result
=
_PyObject_CallMethodId
(
list
,
&
PyId_insert
,
"nO"
,
index
,
item
);
if
(
result
==
NULL
)
return
NULL
;
...
...
Modules/_datetimemodule.c
View file @
e75fc148
...
...
@@ -104,6 +104,11 @@ static PyTypeObject PyDateTime_TimeType;
static
PyTypeObject
PyDateTime_TZInfoType
;
static
PyTypeObject
PyDateTime_TimeZoneType
;
_Py_IDENTIFIER
(
as_integer_ratio
);
_Py_IDENTIFIER
(
fromutc
);
_Py_IDENTIFIER
(
isoformat
);
_Py_IDENTIFIER
(
strftime
);
/* ---------------------------------------------------------------------------
* Math utilities.
*/
...
...
@@ -1277,8 +1282,6 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
goto
Done
;
format
=
PyUnicode_FromString
(
PyBytes_AS_STRING
(
newfmt
));
if
(
format
!=
NULL
)
{
_Py_IDENTIFIER
(
strftime
);
result
=
_PyObject_CallMethodId
(
time
,
&
PyId_strftime
,
"OO"
,
format
,
timetuple
,
NULL
);
Py_DECREF
(
format
);
...
...
@@ -1566,7 +1569,6 @@ multiply_float_timedelta(PyObject *floatobj, PyDateTime_Delta *delta)
PyObject
*
result
=
NULL
;
PyObject
*
pyus_in
=
NULL
,
*
temp
,
*
pyus_out
;
PyObject
*
ratio
=
NULL
;
_Py_IDENTIFIER
(
as_integer_ratio
);
pyus_in
=
delta_to_microseconds
(
delta
);
if
(
pyus_in
==
NULL
)
...
...
@@ -1665,7 +1667,6 @@ truedivide_timedelta_float(PyDateTime_Delta *delta, PyObject *f)
PyObject
*
result
=
NULL
;
PyObject
*
pyus_in
=
NULL
,
*
temp
,
*
pyus_out
;
PyObject
*
ratio
=
NULL
;
_Py_IDENTIFIER
(
as_integer_ratio
);
pyus_in
=
delta_to_microseconds
(
delta
);
if
(
pyus_in
==
NULL
)
...
...
@@ -2635,8 +2636,6 @@ date_isoformat(PyDateTime_Date *self)
static
PyObject
*
date_str
(
PyDateTime_Date
*
self
)
{
_Py_IDENTIFIER
(
isoformat
);
return
_PyObject_CallMethodId
((
PyObject
*
)
self
,
&
PyId_isoformat
,
"()"
);
}
...
...
@@ -2676,7 +2675,6 @@ static PyObject *
date_format
(
PyDateTime_Date
*
self
,
PyObject
*
args
)
{
PyObject
*
format
;
_Py_IDENTIFIER
(
strftime
);
if
(
!
PyArg_ParseTuple
(
args
,
"U:__format__"
,
&
format
))
return
NULL
;
...
...
@@ -3593,8 +3591,6 @@ time_repr(PyDateTime_Time *self)
static
PyObject
*
time_str
(
PyDateTime_Time
*
self
)
{
_Py_IDENTIFIER
(
isoformat
);
return
_PyObject_CallMethodId
((
PyObject
*
)
self
,
&
PyId_isoformat
,
"()"
);
}
...
...
@@ -4207,7 +4203,6 @@ datetime_now_impl(PyObject *cls, PyObject *tz)
if
(
self
!=
NULL
&&
tz
!=
Py_None
)
{
/* Convert UTC to tzinfo's zone. */
PyObject
*
temp
=
self
;
_Py_IDENTIFIER
(
fromutc
);
self
=
_PyObject_CallMethodId
(
tz
,
&
PyId_fromutc
,
"O"
,
self
);
Py_DECREF
(
temp
);
...
...
@@ -4246,7 +4241,6 @@ datetime_fromtimestamp(PyObject *cls, PyObject *args, PyObject *kw)
if
(
self
!=
NULL
&&
tzinfo
!=
Py_None
)
{
/* Convert UTC to tzinfo's zone. */
PyObject
*
temp
=
self
;
_Py_IDENTIFIER
(
fromutc
);
self
=
_PyObject_CallMethodId
(
tzinfo
,
&
PyId_fromutc
,
"O"
,
self
);
Py_DECREF
(
temp
);
...
...
@@ -4529,8 +4523,6 @@ datetime_repr(PyDateTime_DateTime *self)
static
PyObject
*
datetime_str
(
PyDateTime_DateTime
*
self
)
{
_Py_IDENTIFIER
(
isoformat
);
return
_PyObject_CallMethodId
((
PyObject
*
)
self
,
&
PyId_isoformat
,
"(s)"
,
" "
);
}
...
...
@@ -4809,7 +4801,6 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
PyObject
*
offset
;
PyObject
*
temp
;
PyObject
*
tzinfo
=
Py_None
;
_Py_IDENTIFIER
(
fromutc
);
static
char
*
keywords
[]
=
{
"tz"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"|O:astimezone"
,
keywords
,
...
...
Modules/_sqlite/connection.c
View file @
e75fc148
...
...
@@ -41,6 +41,8 @@
#endif
#endif
_Py_IDENTIFIER
(
cursor
);
static
int
pysqlite_connection_set_isolation_level
(
pysqlite_Connection
*
self
,
PyObject
*
isolation_level
);
static
void
_pysqlite_drop_unused_cursor_references
(
pysqlite_Connection
*
self
);
...
...
@@ -1279,7 +1281,6 @@ PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args,
PyObject
*
cursor
=
0
;
PyObject
*
result
=
0
;
PyObject
*
method
=
0
;
_Py_IDENTIFIER
(
cursor
);
cursor
=
_PyObject_CallMethodId
((
PyObject
*
)
self
,
&
PyId_cursor
,
""
);
if
(
!
cursor
)
{
...
...
@@ -1309,7 +1310,6 @@ PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* a
PyObject
*
cursor
=
0
;
PyObject
*
result
=
0
;
PyObject
*
method
=
0
;
_Py_IDENTIFIER
(
cursor
);
cursor
=
_PyObject_CallMethodId
((
PyObject
*
)
self
,
&
PyId_cursor
,
""
);
if
(
!
cursor
)
{
...
...
@@ -1339,7 +1339,6 @@ PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject*
PyObject
*
cursor
=
0
;
PyObject
*
result
=
0
;
PyObject
*
method
=
0
;
_Py_IDENTIFIER
(
cursor
);
cursor
=
_PyObject_CallMethodId
((
PyObject
*
)
self
,
&
PyId_cursor
,
""
);
if
(
!
cursor
)
{
...
...
Objects/typeobject.c
View file @
e75fc148
...
...
@@ -39,16 +39,20 @@ struct method_cache_entry {
static
struct
method_cache_entry
method_cache
[
1
<<
MCACHE_SIZE_EXP
];
static
unsigned
int
next_version_tag
=
0
;
/* alphabetical order */
_Py_IDENTIFIER
(
__abstractmethods__
);
_Py_IDENTIFIER
(
__class__
);
_Py_IDENTIFIER
(
__delitem__
);
_Py_IDENTIFIER
(
__dict__
);
_Py_IDENTIFIER
(
__doc__
);
_Py_IDENTIFIER
(
__getitem__
);
_Py_IDENTIFIER
(
__getattribute__
);
_Py_IDENTIFIER
(
__getitem__
);
_Py_IDENTIFIER
(
__hash__
);
_Py_IDENTIFIER
(
__len__
);
_Py_IDENTIFIER
(
__module__
);
_Py_IDENTIFIER
(
__name__
);
_Py_IDENTIFIER
(
__new__
);
_Py_IDENTIFIER
(
__
abstractmethods
__
);
_Py_IDENTIFIER
(
__
setitem
__
);
static
PyObject
*
slot_tp_new
(
PyTypeObject
*
type
,
PyObject
*
args
,
PyObject
*
kwds
);
...
...
@@ -5068,7 +5072,6 @@ FUNCNAME(PyObject *self, ARG1TYPE arg1, ARG2TYPE arg2) \
static
Py_ssize_t
slot_sq_length
(
PyObject
*
self
)
{
_Py_IDENTIFIER
(
__len__
);
PyObject
*
res
=
call_method
(
self
,
&
PyId___len__
,
"()"
);
Py_ssize_t
len
;
...
...
@@ -5129,8 +5132,6 @@ static int
slot_sq_ass_item
(
PyObject
*
self
,
Py_ssize_t
index
,
PyObject
*
value
)
{
PyObject
*
res
;
_Py_IDENTIFIER
(
__delitem__
);
_Py_IDENTIFIER
(
__setitem__
);
if
(
value
==
NULL
)
res
=
call_method
(
self
,
&
PyId___delitem__
,
"(n)"
,
index
);
...
...
@@ -5180,8 +5181,6 @@ static int
slot_mp_ass_subscript
(
PyObject
*
self
,
PyObject
*
key
,
PyObject
*
value
)
{
PyObject
*
res
;
_Py_IDENTIFIER
(
__delitem__
);
_Py_IDENTIFIER
(
__setitem__
);
if
(
value
==
NULL
)
res
=
call_method
(
self
,
&
PyId___delitem__
,
"(O)"
,
key
);
...
...
@@ -5232,7 +5231,6 @@ slot_nb_bool(PyObject *self)
PyObject
*
func
,
*
args
;
int
result
=
-
1
;
int
using_len
=
0
;
_Py_IDENTIFIER
(
__len__
);
_Py_IDENTIFIER
(
__bool__
);
func
=
lookup_maybe
(
self
,
&
PyId___bool__
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment