New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyLong_AsVoidPtr()/PyLong_FromVoidPtr() #37611
Comments
These two functions have mutually-recursive definitions |
Logged In: YES Would you like to provide a patch? |
Logged In: YES Thanks for asking but the problem is that I don't know what |
Logged In: YES Something very simple: PyObject *
PyLong_FromVoidPtr(void *p)
{
#if SIZEOF_VOID_P <= SIZEOF_LONG
return PyInt_FromLong((long)p);
#else
#ifndef HAVE_LONG_LONG
# error "PyLong_FromVoidPtr: sizeof(void*) > sizeof(long),
but no long long"
#endif
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
# error "PyLong_FromVoidPtr: sizeof(LONG_LONG) < sizeof
(void*)"
#endif
/* optimize null pointers */
if (p == NULL)
return PyInt_FromLong(0);
return PyLong_FromLongLong((LONG_LONG)p); #endif /* SIZEOF_VOID_P <= SIZEOF_LONG */ |
Logged In: YES Tim, aren't these your babies? |
Logged In: YES Nope. Guido checked them in 5 years ago, in rev 1.48. To |
Logged In: YES I think the definitions are pretty clear to understand. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: