LEFT | RIGHT |
1 /* Built-in functions */ | 1 /* Built-in functions */ |
2 | 2 |
3 #include "Python.h" | 3 #include "Python.h" |
4 #include "Python-ast.h" | 4 #include "Python-ast.h" |
5 | 5 |
6 #include "node.h" | 6 #include "node.h" |
7 #include "code.h" | 7 #include "code.h" |
8 #include "eval.h" | 8 #include "eval.h" |
9 | 9 |
10 #include <ctype.h> | 10 #include <ctype.h> |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 static PyObject * | 268 static PyObject * |
269 builtin_ascii(PyObject *self, PyObject *v) | 269 builtin_ascii(PyObject *self, PyObject *v) |
270 { | 270 { |
271 return PyObject_ASCII(v); | 271 return PyObject_ASCII(v); |
272 } | 272 } |
273 | 273 |
274 PyDoc_STRVAR(ascii_doc, | 274 PyDoc_STRVAR(ascii_doc, |
275 "ascii(object) -> string\n\ | 275 "ascii(object) -> string\n\ |
276 \n\ | 276 \n\ |
277 Return the canonical string representation of the object as repr(),\n\ | 277 Return the canonical string representation of the object as repr().\n\ |
278 but non-ASCII characters in the string are hex-escaped"); | 278 But unlike :func:`repr`, the non-ASCII characters in the string\n\ |
| 279 returned by :func:`repr` are backslash-escaped (with ``\\x``, ``\\u``\n\ |
| 280 or ``\\U``) to generate a same string as :func:`repr` in Python 2."); |
279 | 281 |
280 | 282 |
281 static PyObject * | 283 static PyObject * |
282 builtin_bin(PyObject *self, PyObject *v) | 284 builtin_bin(PyObject *self, PyObject *v) |
283 { | 285 { |
284 return PyNumber_ToBase(v, 2); | 286 return PyNumber_ToBase(v, 2); |
285 } | 287 } |
286 | 288 |
287 PyDoc_STRVAR(bin_doc, | 289 PyDoc_STRVAR(bin_doc, |
288 "bin(number) -> string\n\ | 290 "bin(number) -> string\n\ |
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2309 if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { | 2311 if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { |
2310 Py_XDECREF(debug); | 2312 Py_XDECREF(debug); |
2311 return NULL; | 2313 return NULL; |
2312 } | 2314 } |
2313 Py_XDECREF(debug); | 2315 Py_XDECREF(debug); |
2314 | 2316 |
2315 return mod; | 2317 return mod; |
2316 #undef ADD_TO_ALL | 2318 #undef ADD_TO_ALL |
2317 #undef SETBUILTIN | 2319 #undef SETBUILTIN |
2318 } | 2320 } |
LEFT | RIGHT |