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
a7b0976c
Commit
a7b0976c
authored
Oct 15, 2011
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PyEval_CallObject requires a tuple of args (closes #13186)
parent
5baef6d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
1 deletion
+31
-1
Lib/test/test_class.py
Lib/test/test_class.py
+13
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_testcapimodule.c
Modules/_testcapimodule.c
+14
-0
Objects/classobject.c
Objects/classobject.c
+1
-1
No files found.
Lib/test/test_class.py
View file @
a7b0976c
...
@@ -350,6 +350,19 @@ class ClassTests(unittest.TestCase):
...
@@ -350,6 +350,19 @@ class ClassTests(unittest.TestCase):
AllTests
.
__delslice__
=
delslice
AllTests
.
__delslice__
=
delslice
@
test_support
.
cpython_only
def
testDelItem
(
self
):
class
A
:
ok
=
False
def
__delitem__
(
self
,
key
):
self
.
ok
=
True
a
=
A
()
# Subtle: we need to call PySequence_SetItem, not PyMapping_SetItem.
from
_testcapi
import
sequence_delitem
sequence_delitem
(
a
,
2
)
self
.
assertTrue
(
a
.
ok
)
def
testUnaryOps
(
self
):
def
testUnaryOps
(
self
):
testme
=
AllTests
()
testme
=
AllTests
()
...
...
Misc/NEWS
View file @
a7b0976c
...
@@ -9,6 +9,9 @@ What's New in Python 2.7.3?
...
@@ -9,6 +9,9 @@ What's New in Python 2.7.3?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #13186: Fix __delitem__ on old-style instances when invoked through
PySequence_DelItem.
- Issue #13156: Revert the patch for issue #10517 (reset TLS upon fork()),
- Issue #13156: Revert the patch for issue #10517 (reset TLS upon fork()),
which was only relevant for the native pthread TLS implementation.
which was only relevant for the native pthread TLS implementation.
...
...
Modules/_testcapimodule.c
View file @
a7b0976c
...
@@ -1639,6 +1639,19 @@ make_exception_with_doc(PyObject *self, PyObject *args, PyObject *kwargs)
...
@@ -1639,6 +1639,19 @@ make_exception_with_doc(PyObject *self, PyObject *args, PyObject *kwargs)
return
PyErr_NewExceptionWithDoc
(
name
,
doc
,
base
,
dict
);
return
PyErr_NewExceptionWithDoc
(
name
,
doc
,
base
,
dict
);
}
}
static
PyObject
*
sequence_delitem
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
seq
;
Py_ssize_t
i
;
if
(
!
PyArg_ParseTuple
(
args
,
"On"
,
&
seq
,
&
i
))
return
NULL
;
if
(
PySequence_DelItem
(
seq
,
i
)
<
0
)
return
NULL
;
Py_RETURN_NONE
;
}
static
PyMethodDef
TestMethods
[]
=
{
static
PyMethodDef
TestMethods
[]
=
{
{
"raise_exception"
,
raise_exception
,
METH_VARARGS
},
{
"raise_exception"
,
raise_exception
,
METH_VARARGS
},
{
"test_config"
,
(
PyCFunction
)
test_config
,
METH_NOARGS
},
{
"test_config"
,
(
PyCFunction
)
test_config
,
METH_NOARGS
},
...
@@ -1695,6 +1708,7 @@ static PyMethodDef TestMethods[] = {
...
@@ -1695,6 +1708,7 @@ static PyMethodDef TestMethods[] = {
{
"code_newempty"
,
code_newempty
,
METH_VARARGS
},
{
"code_newempty"
,
code_newempty
,
METH_VARARGS
},
{
"make_exception_with_doc"
,
(
PyCFunction
)
make_exception_with_doc
,
{
"make_exception_with_doc"
,
(
PyCFunction
)
make_exception_with_doc
,
METH_VARARGS
|
METH_KEYWORDS
},
METH_VARARGS
|
METH_KEYWORDS
},
{
"sequence_delitem"
,
(
PyCFunction
)
sequence_delitem
,
METH_VARARGS
},
{
NULL
,
NULL
}
/* sentinel */
{
NULL
,
NULL
}
/* sentinel */
};
};
...
...
Objects/classobject.c
View file @
a7b0976c
...
@@ -1221,7 +1221,7 @@ instance_ass_item(PyInstanceObject *inst, Py_ssize_t i, PyObject *item)
...
@@ -1221,7 +1221,7 @@ instance_ass_item(PyInstanceObject *inst, Py_ssize_t i, PyObject *item)
if
(
func
==
NULL
)
if
(
func
==
NULL
)
return
-
1
;
return
-
1
;
if
(
item
==
NULL
)
if
(
item
==
NULL
)
arg
=
Py
Int_FromSsize_t
(
i
);
arg
=
Py
_BuildValue
(
"(n)"
,
i
);
else
else
arg
=
Py_BuildValue
(
"(nO)"
,
i
,
item
);
arg
=
Py_BuildValue
(
"(nO)"
,
i
,
item
);
if
(
arg
==
NULL
)
{
if
(
arg
==
NULL
)
{
...
...
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