File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -363,6 +363,9 @@ C-API
363363Library
364364-------
365365
366+ - Issue #8477: _ssl._test_decode_cert() supports str with surrogates and bytes
367+ for the filename
368+
366369- Issue #8550: Add first class ``SSLContext`` objects to the ssl module.
367370
368371- Issue #8681: Make the zlib module's error messages more informative when
Original file line number Diff line number Diff line change @@ -811,13 +811,13 @@ static PyObject *
811811PySSL_test_decode_certificate (PyObject * mod , PyObject * args ) {
812812
813813 PyObject * retval = NULL ;
814- char * filename = NULL ;
814+ PyObject * filename ;
815815 X509 * x = NULL ;
816816 BIO * cert ;
817817 int verbose = 1 ;
818818
819- if (!PyArg_ParseTuple (args , "s |i:test_decode_certificate" ,
820- & filename , & verbose ))
819+ if (!PyArg_ParseTuple (args , "O& |i:test_decode_certificate" ,
820+ PyUnicode_FSConverter , & filename , & verbose ))
821821 return NULL ;
822822
823823 if ((cert = BIO_new (BIO_s_file ())) == NULL ) {
@@ -826,7 +826,7 @@ PySSL_test_decode_certificate (PyObject *mod, PyObject *args) {
826826 goto fail0 ;
827827 }
828828
829- if (BIO_read_filename (cert ,filename ) <= 0 ) {
829+ if (BIO_read_filename (cert , PyBytes_AsString ( filename ) ) <= 0 ) {
830830 PyErr_SetString (PySSLErrorObject ,
831831 "Can't open file" );
832832 goto fail0 ;
@@ -842,7 +842,7 @@ PySSL_test_decode_certificate (PyObject *mod, PyObject *args) {
842842 retval = _decode_certificate (x , verbose );
843843
844844 fail0 :
845-
845+ Py_DECREF ( filename );
846846 if (cert != NULL ) BIO_free (cert );
847847 return retval ;
848848}
You can’t perform that action at this time.
0 commit comments