Skip to content

Commit f5a90f3

Browse files
committed
Cleanup error messages
1 parent db8ca3e commit f5a90f3

File tree

1 file changed

+6
-35
lines changed

1 file changed

+6
-35
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/ErrorMessages.java

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,13 @@ public abstract class ErrorMessages {
5151
public static final String ARG_S_MUST_BE_S_NOT_P = "%s argument %s must be %s, not %p";
5252
public static final String ARG_D_MUST_BE_S_OR_S = "%s argument %d must be '%s' or '%s'";
5353
public static final String ARG_S_MUST_BE_A_LIST_OR_TUPLE = "%s must be a list or tuple";
54-
public static final String ARG_D_MUST_NOT_BE_EMPTY = "arg %d must not be empty";
55-
public static final String ARG_EXPECTED_GOT = "%s argument expected, got %p";
5654
public static final String ARG_IS_EMPTY_SEQ = "%s() arg is an empty sequence";
5755
public static final String ARG_MUST_BE_INT_OR_HAVE_FILENO_METHOD = "argument must be an int, or have a fileno() method.";
5856
public static final String ARG_MUST_BE_NUMBER = "%s argument must be a number, not '%p'";
5957
public static final String ARG_MUST_BE_S_NOT_P = "%s argument must be a %s, not %p";
6058
public static final String S_BRACKETS_ARG_MUST_BE_S_NOT_P = "%s() argument must be a %s, not %p";
6159
public static final String ARG_MUST_BE_STRING_OR_BYTELIKE_OR_NUMBER = "%s argument must be a string, a bytes-like object or a number, not %p";
6260
public static final String ARG_MUST_BE_STRING_OR_NUMBER = "%s argument must be a string or a number, not '%p'";
63-
public static final String ARG_MUST_BE_UNICODE = "%s argument %d must be a unicode character, not %p";
6461
public static final String ARG_MUST_NOT_BE_ZERO = "%s arg %d must not be zero";
6562
public static final String ARG_MUST_NOT_BE_EMPTY = "%s arg %d must not be empty";
6663
public static final String ARG_NOT_IN_RANGE = "%s arg not in range(%s)";
@@ -93,7 +90,6 @@ public abstract class ErrorMessages {
9390
public static final String BAD_MEMBER_DESCR_TYPE_FOR_P = "bad memberdescr type for %p";
9491
public static final String BAD_OPERAND_FOR = "bad operand type for %s%s: '%p'";
9592
public static final String BAD_VALUES_IN_FDS_TO_KEEP = "bad value(s) in fds_to_keep";
96-
public static final String BAD_TYPECODE = "bad typecode (must be i, d, b, B, or l)";
9793
public static final String BASE_OUT_OF_RANGE_FOR_INT = "base is out of range for int()";
9894
public static final String BASES_MUST_BE_TYPES = "bases must be types";
9995
public static final String BASES_ITEM_CAUSES_INHERITANCE_CYCLE = "a __bases__ item causes an inheritance cycle";
@@ -121,7 +117,6 @@ public abstract class ErrorMessages {
121117
public static final String CANNOT_ASSIGN_TO = "cannot assign to %s";
122118
public static final String CANNOT_ASSIGN_TO_COMPREHENSION = "cannot assign to %s comprehension";
123119
public static final String CANNOT_BE_INTEPRETED_AS_LONG = "%s cannot be interpreted as long (type %p)";
124-
public static final String CANNOT_BE_NEGATIVE = "%s cannot be negative";
125120
public static final String S_CANNOT_BE_NEGATIVE_INTEGER_D = "%s cannot be negative integer (%d)";
126121
public static final String CANNOT_CALL_CTOR_OF = "cannot call constructor of %s";
127122
public static final String CANNOT_CLOSE_EXPORTED_PTRS_EXIST = "cannot close exported pointers exist";
@@ -153,13 +148,9 @@ public abstract class ErrorMessages {
153148
public static final String CANNOT_LOAD = "cannot load %s: %s";
154149
public static final String CANNOT_LOAD_M = "cannot load %s: %m";
155150
public static final String CANNOT_RELEASE_UNAQUIRED_LOCK = "cannot release un-acquired lock";
156-
public static final String CANNOT_RESIZE_BUFFER = "cannot resize buffer";
157-
public static final String CANNOT_SET_VERIFY_MODE_TO_CERT_NONE = "Cannot set verify_mode to CERT_NONE when check_hostname is enabled.";
158-
public static final String CANNOT_SPECIFY_FILTERS = "Cannot specify filters except with FORMAT_RAW";
159151
public static final String CANNOT_SPECIFY_BOTH_COMMA_AND_UNDERSCORE = "Cannot specify both ',' and '_'.";
160152
public static final String CANNOT_SPECIFY_C_WITH_C = "Cannot specify '%c' with '%c'.";
161153
public static final String CANNOT_USE_FD_AND_FOLLOW_SYMLINKS_TOGETHER = "%s: cannot use fd and follow_symlinks together";
162-
public static final String CANNOT_USE_TO_INITIALIZE_ARRAY = "cannot use a %p to initialize an array with typecode '%s'";
163154
public static final String CANT_CONCAT_S_TO_P = "can't concat %s to %p";
164155
public static final String CANT_CONVERT_TO_FLOAT = "can't convert %s to float";
165156
public static final String CANT_CONVERT_TO_STR_EXPLICITELY = "Can't convert '%p' object to str implicitly";
@@ -169,7 +160,6 @@ public abstract class ErrorMessages {
169160
public static final String CANT_EXTEND_JAVA_CLASS_NOT_TYPE = "Function extend needs a Java type as its argument not %p";
170161
public static final String CANT_FIND_MODULE = "can't find module '%s'";
171162
public static final String CANT_MULTIPLY_SEQ_BY_NON_INT = "can't multiply sequence by non-int of type '%p'";
172-
public static final String CANT_PICKLE_FUNC_OBJS = "can't pickle function objects";
173163
public static final String CANT_SET_S_S = "can't set %s.%s";
174164
public static final String CANT_SET_ATTRIBUTES_OF_TYPE = "can't set attributes of %s";
175165
public static final String CANT_SET_ATTRIBUTES_OF_TYPE_S = "can't set attributes of built-in/extension type '%s'";
@@ -204,7 +194,6 @@ public abstract class ErrorMessages {
204194
public static final String CORRUPTED_CAPI_LIB_OBJ = "corrupted C API library object: %s";
205195
public static final String COULD_NOT_CONVERT_STRING_TO_COMPLEX = "could not convert string to complex: %s";
206196
public static final String COULD_NOT_CONVERT_STRING_TO_FLOAT = "could not convert string to float: %s";
207-
public static final String COULD_NOT_GET_BYTES_OF_MEMORYVIEW = "could not get bytes of memoryview";
208197
public static final String COUNT_FUNC_MATH = "count function in Math";
209198
public static final String COVERAGE_TRACKER_NOT_RUNNING = "coverage tracker not running";
210199
public static final String CREATING_SOCKETS_NOT_ALLOWED = "creating sockets not allowed";
@@ -223,10 +212,7 @@ public abstract class ErrorMessages {
223212
public static final String SUPER_NO_CLASS = "super(): no arguments";
224213
public static final String SUPER_EMPTY_CLASS = "super(): empty __class__ cell";
225214
public static final String EMPTY_SEPARATOR = "empty separator";
226-
public static final String EMPTY_STR_FOR_COMPLEX = "empty string for complex()";
227-
public static final String ENCODING_WITHOUT_STR_ARG = "encoding without a string argument";
228215
public static final String S_MUST_BE_NONE_OR_STRING = "%s must be None or a string, not %p";
229-
public static final String END_MUST_BE_NONE_OR_STRING = "end must be None or a string, not %p";
230216
public static final String ERROR_5_WHILE_DECOMPRESSING = "Error -5 while decompressing data: incomplete or truncated stream";
231217
public static final String ERROR_WRITING_FORKEXEC = "there was an error writing the fork_exec error to the error pipe";
232218
public static final String ERROR_CALLING_SET_NAME = "Error calling __set_name__ on '%p' instance '%s' in '%N'";
@@ -269,7 +255,6 @@ public abstract class ErrorMessages {
269255
public static final String FOREIGN_OBJ_HAS_NO_ATTR_S = "foreign object has no attribute '%s'";
270256
public static final String FOREIGN_OBJ_ISNT_ITERABLE = "foreign object is not iterable";
271257
public static final String FORMAT_REQUIRES_MAPPING = "format requires a mapping";
272-
public static final String FORMAT_SPEC_MUST_BE_STRING = "format_spec must be a string";
273258
public static final String FORMATED_S_TOO_LONG = "formatted %s is too long (precision too large?)";
274259
public static final String FREE_VAR_REFERENCED_BEFORE_ASSIGMENT = "free variable '%s' referenced before assignment in enclosing scope";
275260
public static final String FUNC_CONSTRUCTION_NOT_SUPPORTED = "function construction not supported for (%p, %p, %p, %p, %p, %p)";
@@ -295,7 +280,6 @@ public abstract class ErrorMessages {
295280
public static final String IDN_ENC_FAILED = "IDN encoding failed: %s";
296281
public static final String IF_YOU_GIVE_ONLY_ONE_ARG_TO_DICT = "if you give only one argument to maketrans it must be a dict";
297282
public static final String INVALID_INDEXING_OF_0_DIM_MEMORY = "invalid indexing of 0-dim memory";
298-
public static final String ILLEGAL_ARG = "illegal argument";
299283
public static final String ILLEGAL_ENVIRONMENT_VARIABLE_NAME = "illegal environment variable name";
300284
public static final String ILLEGAL_EXPRESSION_FOR_AUGMENTED_ASSIGNEMNT = "illegal expression for augmented assignment";
301285
public static final String ILLEGAL_IP_STRING_PASSED_TO = "illegal IP address string passed to %s";
@@ -321,8 +305,6 @@ public abstract class ErrorMessages {
321305
public static final String INTEGER_REQUIRED_GOT = "an integer is required (got type %p)";
322306
public static final String INTERMEDIATE_OVERFLOW_IN = "intermediate overflow in %s";
323307
public static final String INVALD_OR_UNREADABLE_CLASSPATH = "invalid or unreadable classpath: '%s' - %m";
324-
public static final String INVALID_OR_UNSUPPORTED_PROTOCOL_VERSION = "invalid or unsupported protocol version: %s";
325-
public static final String INVALID_OR_UNSUPPORTED_KEYSTORE = "invalid or unsupported keystore: %s";
326308
public static final String INVALID_ARGS = "%s: invalid arguments";
327309
public static final String INVALID_ARGS_FOR_ALLOCFUNC = "invalid arguments for allocfunc (expected 2 but got %s)";
328310
public static final String INVALID_ARGS_FOR_FASTCALL_METHOD = "invalid arguments for fastcall method (expected 3 but got %s)";
@@ -333,7 +315,6 @@ public abstract class ErrorMessages {
333315
public static final String INVALID_CONTAINER_FORMAT = "Invalid container format: %d";
334316
public static final String INVALID_ESCAPE_AT = "invalid %s escape at position %d";
335317
public static final String INVALID_ESCAPE_SEQ_AT = "invalid escape sequence '\\%s' at position %d";
336-
public static final String INVALID_FILE_DESCRIPTOR = "invalid file descriptor";
337318
public static final String INVALID_FILTER = "Invalid filter ID: %d";
338319
public static final String INVALID_FILTER_CHAIN_FOR_FORMAT = "Invalid filter chain for FORMAT_ALONE - must be a single LZMA1 filter";
339320
public static final String INVALID_INDEX_S = "invalid index %s";
@@ -364,14 +345,11 @@ public abstract class ErrorMessages {
364345
public static final String INIT_TAKES_ONE_ARG = "%N.__init__() takes exactly one argument (the instance to initialize)";
365346
public static final String INIT_TAKES_ONE_ARG_OBJECT = "object.__init__() takes exactly one argument (the instance to initialize)";
366347
public static final String INVALID_VALUE_NAN = "Invalid value NaN (not a number)";
367-
public static final String INVALID_VALUE_FOR_VERIFY_MODE = "invalid value for verify_mode";
368348
public static final String IS_NOT_SUBTYPE_OF = "%s.__new__(%N): %N is not a subtype of %s";
369349
public static final String IS_NOT_TYPE_OBJ = "%s is not a type object (%p)";
370350
public static final String ISINSTANCE_ARG_2_MUST_BE_TYPE_OR_TUPLE_OF_CLSS_WAS = "issubclass() arg 2 must be a class or tuple of classes";
371351
public static final String ISINSTANCE_ARG_2_MUST_BE_TYPE_OR_TUPLE_OF_TYPE = "isinstance() arg 2 must be a type or tuple of types (was: %s)";
372-
public static final String ISNT_IN_BYTES_LITERAL = "%s is not in bytes literal";
373352
public static final String ISSUBCLASS_MUST_BE_CLASS_OR_TUPLE = "issubclass() arg 2 must be a class or tuple of classes";
374-
public static final String ITER_RETURNED_NON_ITERABLE = "iter() returned non-iterator of type '%p'";
375353
public static final String ITER_V_MUST_BE_CALLABLE = "iter(v, w): v must be callable";
376354
public static final String KEYWORD_NAMES_MUST_BE_STR_GOT_P = "keyword names must be str, get %p";
377355
public static final String KEYWORDS_MUST_BE_STRINGS = "%s() keywords must be strings";
@@ -395,7 +373,6 @@ public abstract class ErrorMessages {
395373
public static final String MEMORYVIEW_INVALID_SLICE_KEY = "memoryview: invalid slice key";
396374
public static final String MEMORYVIEW_A_BYTES_LIKE_OBJECT_REQUIRED_NOT_P = "memoryview: a bytes-like object is required, not '%p'";
397375
public static final String MEMORYVIEW_INVALID_VALUE_FOR_FORMAT_S = "memoryview: invalid value for format '%s'";
398-
public static final String MEMORYVIEW_INVALID_TYPE_FOR_FORMAT_S = "memoryview: invalid type for format '%s'";
399376
public static final String MEMORYVIEW_SLICE_ASSIGNMENT_RESTRICTED_TO_DIM_1 = "memoryview slice assignments are currently restricted to ndim = 1";
400377
public static final String MEMORYVIEW_DIFFERENT_STRUCTURES = "memoryview assignment: lvalue and rvalue have different structures";
401378
public static final String MEMORYVIEW_FORBIDDEN_RELEASED = "operation forbidden on released memoryview object";
@@ -502,7 +479,6 @@ public abstract class ErrorMessages {
502479
public static final String PYTHON_INT_TOO_LARGE_TO_CONV_TO = "Python int too large to convert to %s";
503480
public static final String PYTHON_INT_TOO_LARGE_TO_CONV_TO_C_TYPE = "Python int too large to convert to %s-byte C type";
504481
public static final String RANGE_OUT_OF_BOUNDS = "range index out of range";
505-
public static final String RAW_FORMAT_NOT_SUPPORTED = "RAW format unsupported";
506482
public static final String READ_BYTE_OUT_OF_RANGE = "read byte out of range";
507483
public static final String READ_WRITE_BYTELIKE_OBJ = "read-write bytes-like object";
508484
public static final String READONLY_ATTRIBUTE = "readonly attribute";
@@ -547,7 +523,6 @@ public abstract class ErrorMessages {
547523
public static final String SHOULD_RETURN = "%s should return %s";
548524
public static final String SHOULD_RETURN_NONE = "%s should return None";
549525
public static final String SIGNAL_MUST_BE_SIGIGN_SIGDFL_OR_CALLABLE_OBJ = "signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object";
550-
public static final String SIGNED_CHAR_GREATER_THAN_MAX = "signed char is greater than maximum";
551526
public static final String SIGNED_INT_GREATER_THAN_MAX = "signed integer is greater than maximum";
552527
public static final String SIGNED_INT_LESS_THAN_MIN = "signed integer is less than minimum";
553528
public static final String SIGNED_SHORT_INT_GREATER_THAN_MAX = "signed short integer is greater than maximum";
@@ -634,14 +609,10 @@ public abstract class ErrorMessages {
634609
public static final String UNSUPPORTED_TARGET_SIZE = "Unsupported target size: %d";
635610
public static final String UNSUPPORTED_USE_OF_SYS_EXECUTABLE = "internal error: unsupported use of sys.executable";
636611
public static final String UTIME_CANNOT_USE_DIR_FD_AND_FOLLOW_SYMLINKS = "utime: cannot use dir_fd and follow_symlinks together on this platform";
637-
public static final String VALUE_EXPECTED = "%s value expected";
638612
public static final String VALUE_TOO_LARGE_TO_FIT_INTO_INDEX = "value too large to fit into index-sized integer";
639-
public static final String VALUE_TOO_LARGE_FOR_S_TYPE = "Value too large for %s type";
640613
public static final String WAS_NOT_POSSIBLE_TO_MARSHAL = "Was not possible to marshal";
641614
public static final String WAS_NOT_POSSIBLE_TO_MARSHAL_P = "Was not possible to marshal %p";
642615
public static final String WEAK_OBJ_GONE_AWAY = "weak object has gone away";
643-
public static final String WORK_DIR_NOT_ACCESSIBLE = "working directory %s is not accessible";
644-
public static final String WRITE_BYTE_OUT_OF_RANGE = "write byte out of range";
645616
public static final String X_NOT_IN_LIST = "x not in list";
646617
public static final String X_NOT_IN_TUPLE = "tuple.index(x): x not in tuple";
647618
public static final String YOU_MAY_SPECIFY_EITHER_OR_BUT_NOT_BOTH = "%s: you may specify either '%s' or '%s' but not both";
@@ -676,9 +647,11 @@ public abstract class ErrorMessages {
676647
public static final String SHOULD_HAVE_RETURNED_EXCEPTION = "calling %N should have returned an instance of BaseException, not %p";
677648
public static final String STRING_KEYS_MUST_BE_LENGTH_1 = "string keys in translate table must be of length 1";
678649
public static final String KEYS_IN_TRANSLATE_TABLE_MUST_BE_STRINGS_OR_INTEGERS = "keys in translate table must be strings or integers";
679-
public static final String EXPECTED_BYTES_P_FOUND = "expected bytes, %p found";
680650
public static final String EMBEDDED_NULL_BYTE = "embedded null byte";
681651
public static final String CANNOT_INTERN_P = "can't intern %p";
652+
public static final String METHOD_REQUIRES_A_BYTES_OBJECT_GOT_P = "Method requires a 'bytes' object, got '%p'";
653+
public static final String FIRST_ARG_MUST_BE_BYTES_OR_A_TUPLE_OF_BYTES_NOT_P = "first arg must be bytes or a tuple of bytes, not %p";
654+
public static final String A_BYTES_LIKE_OBJECT_IS_REQUIRED_NOT_P = "a bytes-like object is required, not '%p'";
682655

683656
// SSL errors
684657
public static final String SSL_SESSION_CLOSED = "SSL/TLS session closed cleanly.";
@@ -700,9 +673,9 @@ public abstract class ErrorMessages {
700673
public static final String CERTIFICATE_VERIFY_FAILED = "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: %s";
701674
public static final String CONTEXT_DOESNT_SUPPORT_MIN_MAX = "The context's protocol doesn't support modification of highest and lowest version.";
702675
public static final String UNSUPPORTED_PROTOCOL_VERSION = "Unsupported protocol version 0x%x";
703-
public static final String METHOD_REQUIRES_A_BYTES_OBJECT_GOT_P = "Method requires a 'bytes' object, got '%p'";
704-
public static final String FIRST_ARG_MUST_BE_BYTES_OR_A_TUPLE_OF_BYTES_NOT_P = "first arg must be bytes or a tuple of bytes, not %p";
705-
public static final String A_BYTES_LIKE_OBJECT_IS_REQUIRED_NOT_P = "a bytes-like object is required, not '%p'";
676+
public static final String CANNOT_SET_VERIFY_MODE_TO_CERT_NONE = "Cannot set verify_mode to CERT_NONE when check_hostname is enabled.";
677+
public static final String INVALID_OR_UNSUPPORTED_PROTOCOL_VERSION = "invalid or unsupported protocol version: %s";
678+
public static final String INVALID_VALUE_FOR_VERIFY_MODE = "invalid value for verify_mode";
706679

707680
// mmap
708681
public static final String MEM_MAPPED_LENGTH_MUST_BE_POSITIVE = "memory mapped length must be positive";
@@ -769,7 +742,6 @@ public abstract class ErrorMessages {
769742
public static final String S_RETURNED_TOO_MUCH_DATA = "%s returned too much data: %d bytes requested, %d returned";
770743
public static final String S_SHOULD_RETURN_BYTES_NOT_P = " should have returned a bytes object, not '%p'";
771744
public static final String BAD_MODE = "Must have exactly one of create/read/write/append mode and at most one plus";
772-
public static final String NEG_FD = "negative file descriptor";
773745
public static final String CANNOT_USE_CLOSEFD = "Cannot use closefd=False with file name";
774746
public static final String EXPECTED_INT_FROM_OPENER = "expected integer from opener";
775747
public static final String OPENER_RETURNED_D = "opener returned %d";
@@ -779,7 +751,6 @@ public abstract class ErrorMessages {
779751
public static final String S_TO_CLOSED_FILE = "%s to closed file";
780752

781753
// pickle errors
782-
public static final String CANNOT_PICKLE_OBJECT = "cannot pickle '%s' object";
783754
public static final String CANNOT_PICKLE_OBJECT_TYPE = "cannot pickle '%p' object";
784755

785756
public static final String P_RETURNED_NON_P = "%p.%s returned non-%s (type %p). " +

0 commit comments

Comments
 (0)