Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-103906: Avoid refcount changes for True, False, None#103907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
hauntsaninja wants to merge1 commit intopython:mainfromhauntsaninja:gh-103906
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletionsPython/bytecodes.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -957,7 +957,7 @@ dummy_func(
if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) {
value = Py_NewRef(((PyStopIterationObject *)exc_value)->value);
DECREF_INPUTS();
none =Py_NewRef(Py_None);
none = Py_None;
}
else {
_PyErr_SetRaisedException(tstate, Py_NewRef(exc_value));
Expand DownExpand Up@@ -1911,7 +1911,6 @@ dummy_func(
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
res = (sign_ish & oparg) ? Py_True : Py_False;
Py_INCREF(res);
}

// Similar to COMPARE_OP_FLOAT
Expand All@@ -1930,7 +1929,6 @@ dummy_func(
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
_Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free);
res = (sign_ish & oparg) ? Py_True : Py_False;
Py_INCREF(res);
}

// Similar to COMPARE_OP_FLOAT, but for ==, != only
Expand All@@ -1946,20 +1944,19 @@ dummy_func(
assert((oparg & 0xf) == COMPARISON_NOT_EQUALS || (oparg & 0xf) == COMPARISON_EQUALS);
assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS);
res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False;
Py_INCREF(res);
}

inst(IS_OP, (left, right -- b)) {
int res = Py_Is(left, right) ^ oparg;
DECREF_INPUTS();
b =Py_NewRef(res ? Py_True : Py_False);
b = res ? Py_True : Py_False;
}

inst(CONTAINS_OP, (left, right -- b)) {
int res = PySequence_Contains(right, left);
DECREF_INPUTS();
ERROR_IF(res < 0, error);
b =Py_NewRef((res^oparg) ? Py_True : Py_False);
b =(res^oparg) ? Py_True : Py_False;
}

inst(CHECK_EG_MATCH, (exc_value, match_type -- rest, match)) {
Expand DownExpand Up@@ -1992,7 +1989,7 @@ dummy_func(

int res = PyErr_GivenExceptionMatches(left, right);
DECREF_INPUTS();
b =Py_NewRef(res ? Py_True : Py_False);
b = res ? Py_True : Py_False;
}

inst(IMPORT_NAME, (level, fromlist -- res)) {
Expand DownExpand Up@@ -2106,19 +2103,19 @@ dummy_func(
}
else {
ERROR_IF(_PyErr_Occurred(tstate), error); // Error!
attrs =Py_NewRef(Py_None); // Failure!
attrs = Py_None; // Failure!
}
}

inst(MATCH_MAPPING, (subject -- subject, res)) {
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
res =Py_NewRef(match ? Py_True : Py_False);
res = match ? Py_True : Py_False;
PREDICT(POP_JUMP_IF_FALSE);
}

inst(MATCH_SEQUENCE, (subject -- subject, res)) {
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
res =Py_NewRef(match ? Py_True : Py_False);
res = match ? Py_True : Py_False;
PREDICT(POP_JUMP_IF_FALSE);
}

Expand DownExpand Up@@ -2309,7 +2306,7 @@ dummy_func(
STAT_INC(FOR_ITER, hit);
_PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe;
frame->return_offset = oparg;
_PyFrame_StackPush(gen_frame,Py_NewRef(Py_None));
_PyFrame_StackPush(gen_frame, Py_None);
gen->gi_frame_state = FRAME_EXECUTING;
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
Expand DownExpand Up@@ -2416,7 +2413,7 @@ dummy_func(
prev_exc = exc_info->exc_value;
}
else {
prev_exc =Py_NewRef(Py_None);
prev_exc = Py_None;
}
assert(PyExceptionInstance_Check(new_exc));
exc_info->exc_value = Py_NewRef(new_exc);
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp