| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 60fe569 commit 81f68a7
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -572,8 +572,12 @@ PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *); | |||
| 572 | 572 | PyAPI_FUNC(int) Py_ReprEnter(PyObject *); | |
| 573 | 573 | PyAPI_FUNC(void) Py_ReprLeave(PyObject *); | |
| 574 | 574 | ||
| 575 | - /* Helper for passing objects to printf and the like */ | ||
| 576 | - #define PyObject_REPR(obj) _PyUnicode_AsString(PyObject_Repr(obj)) | ||
| 575 | + #ifndef Py_LIMITED_API | ||
| 576 | + /* Helper for passing objects to printf and the like. | ||
| 577 | + Leaks refcounts. Don't use it! | ||
| 578 | + */ | ||
| 579 | + #define PyObject_REPR(obj) PyUnicode_AsUTF8(PyObject_Repr(obj)) | ||
| 580 | + #endif | ||
| 577 | 581 | ||
| 578 | 582 | /* Flag bits for printing: */ | |
| 579 | 583 | #define Py_PRINT_RAW 1 /* No string quotes etc. */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1412,12 +1412,12 @@ get_ref_type(struct compiler *c, PyObject *name) | |||
| 1412 | 1412 | PyOS_snprintf(buf, sizeof(buf), | |
| 1413 | 1413 | "unknown scope for %.100s in %.100s(%s)\n" | |
| 1414 | 1414 | "symbols: %s\nlocals: %s\nglobals: %s", | |
| 1415 | - PyBytes_AS_STRING(name), | ||
| 1416 | - PyBytes_AS_STRING(c->u->u_name), | ||
| 1417 | - PyObject_REPR(c->u->u_ste->ste_id), | ||
| 1418 | - PyObject_REPR(c->u->u_ste->ste_symbols), | ||
| 1419 | - PyObject_REPR(c->u->u_varnames), | ||
| 1420 | - PyObject_REPR(c->u->u_names) | ||
| 1415 | + PyUnicode_AsUTF8(name), | ||
| 1416 | + PyUnicode_AsUTF8(c->u->u_name), | ||
| 1417 | + PyUnicode_AsUTF8(PyObject_Repr(c->u->u_ste->ste_id)), | ||
| 1418 | + PyUnicode_AsUTF8(PyObject_Repr(c->u->u_ste->ste_symbols)), | ||
| 1419 | + PyUnicode_AsUTF8(PyObject_Repr(c->u->u_varnames)), | ||
| 1420 | + PyUnicode_AsUTF8(PyObject_Repr(c->u->u_names)) | ||
| 1421 | 1421 | ); | |
| 1422 | 1422 | Py_FatalError(buf); | |
| 1423 | 1423 | } | |
@@ -1474,11 +1474,11 @@ compiler_make_closure(struct compiler *c, PyCodeObject *co, Py_ssize_t args, PyO | |||
| 1474 | 1474 | fprintf(stderr, | |
| 1475 | 1475 | "lookup %s in %s %d %d\n" | |
| 1476 | 1476 | "freevars of %s: %s\n", | |
| 1477 | - PyObject_REPR(name), | ||
| 1478 | - PyBytes_AS_STRING(c->u->u_name), | ||
| 1477 | + PyUnicode_AsUTF8(PyObject_Repr(name)), | ||
| 1478 | + PyUnicode_AsUTF8(c->u->u_name), | ||
| 1479 | 1479 | reftype, arg, | |
| 1480 | - _PyUnicode_AsString(co->co_name), | ||
| 1481 | - PyObject_REPR(co->co_freevars)); | ||
| 1480 | + PyUnicode_AsUTF8(co->co_name), | ||
| 1481 | + PyUnicode_AsUTF8(PyObject_Repr(co->co_freevars))); | ||
| 1482 | 1482 | Py_FatalError("compiler_make_closure()"); | |
| 1483 | 1483 | } | |
| 1484 | 1484 | ADDOP_I(c, LOAD_CLOSURE, arg); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments