mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
Issue #27007: The fromhex() class methods of bytes and bytearray subclasses
now return an instance of corresponding subclass.
This commit is contained in:
parent
cf8b42e904
commit
0855e706aa
5 changed files with 50 additions and 10 deletions
|
|
@ -2303,7 +2303,12 @@ static PyObject *
|
|||
bytes_fromhex_impl(PyTypeObject *type, PyObject *string)
|
||||
/*[clinic end generated code: output=0973acc63661bb2e input=bf4d1c361670acd3]*/
|
||||
{
|
||||
return _PyBytes_FromHex(string, 0);
|
||||
PyObject *result = _PyBytes_FromHex(string, 0);
|
||||
if (type != &PyBytes_Type && result != NULL) {
|
||||
Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
|
||||
result, NULL));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
PyObject*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue