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
cbb02846
Commit
cbb02846
authored
Dec 01, 2012
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16590: remove obsolete compatibility code from the _json module.
Patch by Serhiy Storchaka.
parent
f02f280b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
40 deletions
+5
-40
Modules/_json.c
Modules/_json.c
+5
-40
No files found.
Modules/_json.c
View file @
cbb02846
...
...
@@ -2,20 +2,6 @@
#include "structmember.h"
#include "accu.h"
#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TYPE)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#endif
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
typedef
int
Py_ssize_t
;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PyInt_FromSsize_t PyInt_FromLong
#define PyInt_AsSsize_t PyInt_AsLong
#endif
#ifndef Py_IS_FINITE
#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
#endif
#ifdef __GNUC__
#define UNUSED __attribute__((__unused__))
#else
...
...
@@ -129,33 +115,12 @@ static void
raise_errmsg
(
char
*
msg
,
PyObject
*
s
,
Py_ssize_t
end
);
static
PyObject
*
encoder_encode_string
(
PyEncoderObject
*
s
,
PyObject
*
obj
);
static
int
_convertPyInt_AsSsize_t
(
PyObject
*
o
,
Py_ssize_t
*
size_ptr
);
static
PyObject
*
_convertPyInt_FromSsize_t
(
Py_ssize_t
*
size_ptr
);
static
PyObject
*
encoder_encode_float
(
PyEncoderObject
*
s
,
PyObject
*
obj
);
#define S_CHAR(c) (c >= ' ' && c <= '~' && c != '\\' && c != '"')
#define IS_WHITESPACE(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r'))
static
int
_convertPyInt_AsSsize_t
(
PyObject
*
o
,
Py_ssize_t
*
size_ptr
)
{
/* PyObject to Py_ssize_t converter */
*
size_ptr
=
PyLong_AsSsize_t
(
o
);
if
(
*
size_ptr
==
-
1
&&
PyErr_Occurred
())
return
0
;
return
1
;
}
static
PyObject
*
_convertPyInt_FromSsize_t
(
Py_ssize_t
*
size_ptr
)
{
/* Py_ssize_t to PyObject converter */
return
PyLong_FromSsize_t
(
*
size_ptr
);
}
static
Py_ssize_t
ascii_escape_unichar
(
Py_UCS4
c
,
unsigned
char
*
output
,
Py_ssize_t
chars
)
{
...
...
@@ -265,7 +230,7 @@ raise_errmsg(char *msg, PyObject *s, Py_ssize_t end)
if
(
errmsg_fn
==
NULL
)
return
;
}
pymsg
=
PyObject_CallFunction
(
errmsg_fn
,
"(zO
O&)"
,
msg
,
s
,
_convertPyInt_FromSsize_t
,
&
end
);
pymsg
=
PyObject_CallFunction
(
errmsg_fn
,
"(zO
n)"
,
msg
,
s
,
end
);
if
(
pymsg
)
{
PyErr_SetObject
(
PyExc_ValueError
,
pymsg
);
Py_DECREF
(
pymsg
);
...
...
@@ -524,7 +489,7 @@ py_scanstring(PyObject* self UNUSED, PyObject *args)
Py_ssize_t
end
;
Py_ssize_t
next_end
=
-
1
;
int
strict
=
1
;
if
(
!
PyArg_ParseTuple
(
args
,
"O
O&|i:scanstring"
,
&
pystr
,
_convertPyInt_AsSsize_t
,
&
end
,
&
strict
))
{
if
(
!
PyArg_ParseTuple
(
args
,
"O
n|i:scanstring"
,
&
pystr
,
&
end
,
&
strict
))
{
return
NULL
;
}
if
(
PyUnicode_Check
(
pystr
))
{
...
...
@@ -1087,7 +1052,7 @@ scanner_call(PyObject *self, PyObject *args, PyObject *kwds)
PyScannerObject
*
s
;
assert
(
PyScanner_Check
(
self
));
s
=
(
PyScannerObject
*
)
self
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O
O&:scan_once"
,
kwlist
,
&
pystr
,
_convertPyInt_AsSsize_t
,
&
idx
))
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O
n:scan_once"
,
kwlist
,
&
pystr
,
&
idx
))
return
NULL
;
if
(
PyUnicode_Check
(
pystr
))
{
...
...
@@ -1288,8 +1253,8 @@ encoder_call(PyObject *self, PyObject *args, PyObject *kwds)
assert
(
PyEncoder_Check
(
self
));
s
=
(
PyEncoderObject
*
)
self
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O
O&
:_iterencode"
,
kwlist
,
&
obj
,
_convertPyInt_AsSsize_t
,
&
indent_level
))
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O
n
:_iterencode"
,
kwlist
,
&
obj
,
&
indent_level
))
return
NULL
;
if
(
_PyAccu_Init
(
&
acc
))
return
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