[Python-bugs-list] [ python-Bugs-653542 ] PyLong_AsVoidPtr()/PyLong_FromVoidPtr()

SourceForge.net noreply at sourceforge.net
Tue Sep 23 21:25:21 EDT 2003


Bugs item #653542, was opened at 2002-12-13 20:02
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=653542&group_id=5470

Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David Abrahams (david_abrahams)
>Assigned to: Nobody/Anonymous (nobody)
Summary: PyLong_AsVoidPtr()/PyLong_FromVoidPtr()

Initial Comment:
These two functions have mutually-recursive definitions 

in the docs (which is to say, none).

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2003-09-23 21:25

Message:
Logged In: YES 
user_id=31435

Nope.  Guido checked them in 5 years ago, in rev 1.48.  To 

judge from the checkin comment, the code may actually have 

come from Greg Stein.  I don't have time for it, so unassigning.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2003-09-23 18:00

Message:
Logged In: YES 
user_id=3066

Tim, aren't these your babies?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-12-14 11:15

Message:
Logged In: YES 
user_id=21627

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 */

}



----------------------------------------------------------------------

Comment By: David Abrahams (david_abrahams)
Date: 2002-12-14 09:37

Message:
Logged In: YES 
user_id=52572

Thanks for asking but the problem is that I don't know what 

they do!

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-12-14 09:15

Message:
Logged In: YES 
user_id=21627

Would you like to provide a patch?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=653542&group_id=5470



More information about the Python-bugs-list mailing list