mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-140916: Remove unused codes in winreg.c (#140934)
This commit is contained in:
parent
b83f379a97
commit
11fc411f98
1 changed files with 0 additions and 55 deletions
55
PC/winreg.c
55
PC/winreg.c
|
|
@ -425,19 +425,6 @@ static PyType_Spec pyhkey_type_spec = {
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
The public PyHKEY API (well, not public yet :-)
|
The public PyHKEY API (well, not public yet :-)
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
PyObject *
|
|
||||||
PyHKEY_New(PyObject *m, HKEY hInit)
|
|
||||||
{
|
|
||||||
winreg_state *st = _PyModule_GetState(m);
|
|
||||||
PyHKEYObject *key = PyObject_GC_New(PyHKEYObject, st->PyHKEY_Type);
|
|
||||||
if (key == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
key->hkey = hInit;
|
|
||||||
PyObject_GC_Track(key);
|
|
||||||
return (PyObject *)key;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
PyHKEY_Close(winreg_state *st, PyObject *ob_handle)
|
PyHKEY_Close(winreg_state *st, PyObject *ob_handle)
|
||||||
{
|
{
|
||||||
|
|
@ -513,48 +500,6 @@ PyHKEY_FromHKEY(winreg_state *st, HKEY h)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
The module methods
|
|
||||||
************************************************************************/
|
|
||||||
BOOL
|
|
||||||
PyWinObject_CloseHKEY(winreg_state *st, PyObject *obHandle)
|
|
||||||
{
|
|
||||||
BOOL ok;
|
|
||||||
if (PyHKEY_Check(st, obHandle)) {
|
|
||||||
ok = PyHKEY_Close(st, obHandle);
|
|
||||||
}
|
|
||||||
#if SIZEOF_LONG >= SIZEOF_HKEY
|
|
||||||
else if (PyLong_Check(obHandle)) {
|
|
||||||
long rc;
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
|
||||||
rc = RegCloseKey((HKEY)PyLong_AsLong(obHandle));
|
|
||||||
Py_END_ALLOW_THREADS
|
|
||||||
ok = (rc == ERROR_SUCCESS);
|
|
||||||
if (!ok)
|
|
||||||
PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
else if (PyLong_Check(obHandle)) {
|
|
||||||
long rc;
|
|
||||||
HKEY hkey = (HKEY)PyLong_AsVoidPtr(obHandle);
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
|
||||||
rc = RegCloseKey(hkey);
|
|
||||||
Py_END_ALLOW_THREADS
|
|
||||||
ok = (rc == ERROR_SUCCESS);
|
|
||||||
if (!ok)
|
|
||||||
PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else {
|
|
||||||
PyErr_SetString(
|
|
||||||
PyExc_TypeError,
|
|
||||||
"A handle must be a HKEY object or an integer");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Private Helper functions for the registry interfaces
|
Private Helper functions for the registry interfaces
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue