@@ -1527,24 +1527,19 @@ encoder_listencode_obj(PyEncoderObject *s, PyUnicodeWriter *writer,
15271527 Py_hash_t ident_hash = -1 ;
15281528 if (s -> markers != Py_None ) {
15291529 Py_ssize_t len ;
1530-
15311530 ident = PyLong_FromVoidPtr (obj );
15321531 if (ident == NULL )
15331532 return -1 ;
1534-
15351533 ident_hash = PyObject_Hash (ident );
15361534 if (ident_hash == -1 ) {
15371535 Py_DECREF (ident );
15381536 return -1 ;
15391537 }
1540-
15411538 len = PyDict_GET_SIZE (s -> markers );
1542-
15431539 if (_PyDict_SetItem_KnownHash (s -> markers , ident , obj , ident_hash )) {
15441540 Py_DECREF (ident );
15451541 return -1 ;
15461542 }
1547-
15481543 if (PyDict_GET_SIZE (s -> markers ) == len ) {
15491544 PyErr_SetString (PyExc_ValueError , "Circular reference detected" );
15501545 Py_DECREF (ident );
@@ -1673,22 +1668,17 @@ encoder_listencode_dict(PyEncoderObject *s, PyUnicodeWriter *writer,
16731668
16741669 if (s -> markers != Py_None ) {
16751670 Py_ssize_t len ;
1676-
16771671 ident = PyLong_FromVoidPtr (dct );
16781672 if (ident == NULL )
1679- return -1 ;
1680-
1673+ goto bail ;
16811674 ident_hash = PyObject_Hash (ident );
16821675 if (ident_hash == -1 ) {
16831676 goto bail ;
16841677 }
1685-
16861678 len = PyDict_GET_SIZE (s -> markers );
1687-
16881679 if (_PyDict_SetItem_KnownHash (s -> markers , ident , dct , ident_hash )) {
16891680 goto bail ;
16901681 }
1691-
16921682 if (PyDict_GET_SIZE (s -> markers ) == len ) {
16931683 PyErr_SetString (PyExc_ValueError , "Circular reference detected" );
16941684 goto bail ;
@@ -1783,22 +1773,17 @@ encoder_listencode_list(PyEncoderObject *s, PyUnicodeWriter *writer,
17831773
17841774 if (s -> markers != Py_None ) {
17851775 Py_ssize_t len ;
1786-
17871776 ident = PyLong_FromVoidPtr (seq );
17881777 if (ident == NULL )
1789- return -1 ;
1790-
1778+ goto bail ;
17911779 ident_hash = PyObject_Hash (ident );
17921780 if (ident_hash == -1 ) {
17931781 goto bail ;
17941782 }
1795-
17961783 len = PyDict_GET_SIZE (s -> markers );
1797-
17981784 if (_PyDict_SetItem_KnownHash (s -> markers , ident , seq , ident_hash )) {
17991785 goto bail ;
18001786 }
1801-
18021787 if (PyDict_GET_SIZE (s -> markers ) == len ) {
18031788 PyErr_SetString (PyExc_ValueError , "Circular reference detected" );
18041789 goto bail ;
0 commit comments