[Python-checkins] CVS: python/dist/src/Include pyport.h,2.32,2.33

Tim Peters tim_one@users.sourceforge.net
Wed, 29 Aug 2001 14:37:11 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv23991/Include

Modified Files:
	pyport.h 
Log Message:
SF bug [#456252] Python should never stomp on [u]intptr_t.
pyport.h:  typedef a new Py_intptr_t type.
    DELICATE ASSUMPTION:  That HAVE_UINTPTR_T implies intptr_t is
    available as well as uintptr_t.  If that turns out not to be
    true, things must get uglier (C99 wants both, so I think it's
    an assumption we're *likely* to get away with).
thread_nt.h, PyThread_start_new_thread:  MS _beginthread is documented
    as returning unsigned long; no idea why uintptr_t was being used.
Others:  Always use Py_[u]intptr_t, never [u]intptr_t directly.


Index: pyport.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v
retrieving revision 2.32
retrieving revision 2.33
diff -C2 -d -r2.32 -r2.33
*** pyport.h	2001/08/08 18:24:45	2.32
--- pyport.h	2001/08/29 21:37:09	2.33
***************
*** 64,77 ****
  /* uintptr_t is the C9X name for an unsigned integral type such that a
   * legitimate void* can be cast to uintptr_t and then back to void* again
!  * without loss of information.
   */
  #ifdef HAVE_UINTPTR_T
! typedef uintptr_t Py_uintptr_t;
  #elif SIZEOF_VOID_P <= SIZEOF_INT
! typedef unsigned int Py_uintptr_t;
  #elif SIZEOF_VOID_P <= SIZEOF_LONG
! typedef unsigned long Py_uintptr_t;
  #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
! typedef unsigned LONG_LONG Py_uintptr_t;
  #else
  #   error "Python needs a typedef for Py_uintptr_t in pyport.h."
--- 64,86 ----
  /* uintptr_t is the C9X name for an unsigned integral type such that a
   * legitimate void* can be cast to uintptr_t and then back to void* again
!  * without loss of information.  Similarly for intptr_t, wrt a signed
!  * integral type.
   */
  #ifdef HAVE_UINTPTR_T
! typedef uintptr_t	Py_uintptr_t;
! typedef intptr_t	Py_intptr_t;
! 
  #elif SIZEOF_VOID_P <= SIZEOF_INT
! typedef unsigned int	Py_uintptr_t;
! typedef int		Py_intptr_t;
! 
  #elif SIZEOF_VOID_P <= SIZEOF_LONG
! typedef unsigned long	Py_uintptr_t;
! typedef long		Py_intptr_t;
! 
  #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
! typedef unsigned LONG_LONG	Py_uintptr_t;
! typedef LONG_LONG		Py_intptr_t;
! 
  #else
  #   error "Python needs a typedef for Py_uintptr_t in pyport.h."