[NumPy-Tickets] [NumPy] #1795: Sort out the NPY_*_FMT printf-formatting macros

NumPy Trac numpy-tickets@scipy....
Tue Apr 5 20:17:20 CDT 2011

#1795: Sort out the NPY_*_FMT printf-formatting macros
 Reporter:  mwiebe  |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  normal  |   Milestone:  Unscheduled
Component:  Other   |     Version:  devel      
 Keywords:          |  
 These macros are supposed to help portably print different types, but
 they're currently not consistent. The points are

 * PyString_Format and PyOS_snprintf support different sets of formatting
 codes (the first is intended to be portable and consistent, the second
 calls the OS vsnprintf routine, according to the 2.7 documentation).

 * Within the NumPy code base, NPY_INTP_FMT is used with PyString_Format,
 while the rest of them are used with PyOS_snprintf.

 * In 2.6, PyString_Format doesn't support a long long formatting
 character, so on 64-bit windows, there is no mechanism to format the
 npy_intp type.

 * The code also casts to long and uses %ld in some places. This would
 produce the wrong value when using extremely large arrays.

Ticket URL: <http://projects.scipy.org/numpy/ticket/1795>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list