mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	There are places in Python which assume bytes have 8-bits. Formalize that a
bit by checking the value of UCHAR_MAX in Include/Python.h. There was a check in Objects/stringobject.c. Remove that. (Note that we don't define UCHAR_MAX if it's not defined as the old test did.)
This commit is contained in:
		
							parent
							
								
									66518bbb67
								
							
						
					
					
						commit
						ac4ea13a3a
					
				
					 2 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
					@ -21,6 +21,14 @@
 | 
				
			||||||
#error "limits.h is required by std C -- why isn't HAVE_LIMITS_H defined?"
 | 
					#error "limits.h is required by std C -- why isn't HAVE_LIMITS_H defined?"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef UCHAR_MAX
 | 
				
			||||||
 | 
					#error "Something's broken.  UCHAR_MAX should be defined in limits.h."
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if UCHAR_MAX != 255
 | 
				
			||||||
 | 
					#error "Python's source code currently assumes 8-bit characters."
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
 | 
					#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
 | 
				
			||||||
#define _SGI_MP_SOURCE
 | 
					#define _SGI_MP_SOURCE
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,10 +8,6 @@
 | 
				
			||||||
int null_strings, one_strings;
 | 
					int null_strings, one_strings;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(HAVE_LIMITS_H) && !defined(UCHAR_MAX)
 | 
					 | 
				
			||||||
#define UCHAR_MAX 255
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static PyStringObject *characters[UCHAR_MAX + 1];
 | 
					static PyStringObject *characters[UCHAR_MAX + 1];
 | 
				
			||||||
static PyStringObject *nullstring;
 | 
					static PyStringObject *nullstring;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue