mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Ensure that instruction cases are self-contained (GH-28938)
This commit is contained in:
		
							parent
							
								
									194a9526d8
								
							
						
					
					
						commit
						e71662c1ae
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		|  | @ -1710,8 +1710,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | ||||||
|             DISPATCH(); |             DISPATCH(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /* We keep LOAD_CLOSURE so that the bytecode stays more readable. */ |  | ||||||
|         TARGET(LOAD_CLOSURE) { |         TARGET(LOAD_CLOSURE) { | ||||||
|  |             /* We keep LOAD_CLOSURE so that the bytecode stays more readable. */ | ||||||
|             PyObject *value = GETLOCAL(oparg); |             PyObject *value = GETLOCAL(oparg); | ||||||
|             if (value == NULL) { |             if (value == NULL) { | ||||||
|                 goto unbound_local_error; |                 goto unbound_local_error; | ||||||
|  | @ -3858,10 +3858,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | ||||||
|             DISPATCH(); |             DISPATCH(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| #define CANNOT_CATCH_MSG "catching classes that do not inherit from "\ |  | ||||||
|                          "BaseException is not allowed" |  | ||||||
| 
 |  | ||||||
|         TARGET(JUMP_IF_NOT_EXC_MATCH) { |         TARGET(JUMP_IF_NOT_EXC_MATCH) { | ||||||
|  |             const char *cannot_catch_msg = "catching classes that do not " | ||||||
|  |                                            "inherit from BaseException is not " | ||||||
|  |                                            "allowed"; | ||||||
|             PyObject *right = POP(); |             PyObject *right = POP(); | ||||||
|             PyObject *left = POP(); |             PyObject *left = POP(); | ||||||
|             if (PyTuple_Check(right)) { |             if (PyTuple_Check(right)) { | ||||||
|  | @ -3871,7 +3871,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | ||||||
|                     PyObject *exc = PyTuple_GET_ITEM(right, i); |                     PyObject *exc = PyTuple_GET_ITEM(right, i); | ||||||
|                     if (!PyExceptionClass_Check(exc)) { |                     if (!PyExceptionClass_Check(exc)) { | ||||||
|                         _PyErr_SetString(tstate, PyExc_TypeError, |                         _PyErr_SetString(tstate, PyExc_TypeError, | ||||||
|                                         CANNOT_CATCH_MSG); |                                          cannot_catch_msg); | ||||||
|                         Py_DECREF(left); |                         Py_DECREF(left); | ||||||
|                         Py_DECREF(right); |                         Py_DECREF(right); | ||||||
|                         goto error; |                         goto error; | ||||||
|  | @ -3881,7 +3881,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | ||||||
|             else { |             else { | ||||||
|                 if (!PyExceptionClass_Check(right)) { |                 if (!PyExceptionClass_Check(right)) { | ||||||
|                     _PyErr_SetString(tstate, PyExc_TypeError, |                     _PyErr_SetString(tstate, PyExc_TypeError, | ||||||
|                                     CANNOT_CATCH_MSG); |                                      cannot_catch_msg); | ||||||
|                     Py_DECREF(left); |                     Py_DECREF(left); | ||||||
|                     Py_DECREF(right); |                     Py_DECREF(right); | ||||||
|                     goto error; |                     goto error; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brandt Bucher
						Brandt Bucher