Skip to content

Commit 11fc411

Browse files
authored
gh-140916: Remove unused codes in winreg.c (#140934)
1 parent b83f379 commit 11fc411

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

PC/winreg.c

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -425,19 +425,6 @@ static PyType_Spec pyhkey_type_spec = {
425425
/************************************************************************
426426
The public PyHKEY API (well, not public yet :-)
427427
************************************************************************/
428-
PyObject *
429-
PyHKEY_New(PyObject *m, HKEY hInit)
430-
{
431-
winreg_state *st = _PyModule_GetState(m);
432-
PyHKEYObject *key = PyObject_GC_New(PyHKEYObject, st->PyHKEY_Type);
433-
if (key == NULL) {
434-
return NULL;
435-
}
436-
key->hkey = hInit;
437-
PyObject_GC_Track(key);
438-
return (PyObject *)key;
439-
}
440-
441428
BOOL
442429
PyHKEY_Close(winreg_state *st, PyObject *ob_handle)
443430
{
@@ -513,48 +500,6 @@ PyHKEY_FromHKEY(winreg_state *st, HKEY h)
513500
}
514501

515502

516-
/************************************************************************
517-
The module methods
518-
************************************************************************/
519-
BOOL
520-
PyWinObject_CloseHKEY(winreg_state *st, PyObject *obHandle)
521-
{
522-
BOOL ok;
523-
if (PyHKEY_Check(st, obHandle)) {
524-
ok = PyHKEY_Close(st, obHandle);
525-
}
526-
#if SIZEOF_LONG >= SIZEOF_HKEY
527-
else if (PyLong_Check(obHandle)) {
528-
long rc;
529-
Py_BEGIN_ALLOW_THREADS
530-
rc = RegCloseKey((HKEY)PyLong_AsLong(obHandle));
531-
Py_END_ALLOW_THREADS
532-
ok = (rc == ERROR_SUCCESS);
533-
if (!ok)
534-
PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey");
535-
}
536-
#else
537-
else if (PyLong_Check(obHandle)) {
538-
long rc;
539-
HKEY hkey = (HKEY)PyLong_AsVoidPtr(obHandle);
540-
Py_BEGIN_ALLOW_THREADS
541-
rc = RegCloseKey(hkey);
542-
Py_END_ALLOW_THREADS
543-
ok = (rc == ERROR_SUCCESS);
544-
if (!ok)
545-
PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey");
546-
}
547-
#endif
548-
else {
549-
PyErr_SetString(
550-
PyExc_TypeError,
551-
"A handle must be a HKEY object or an integer");
552-
return FALSE;
553-
}
554-
return ok;
555-
}
556-
557-
558503
/*
559504
Private Helper functions for the registry interfaces
560505

0 commit comments

Comments
 (0)